How to Use COALESCE in Oracle
Last updated August 25, 2026 · By the SaturnSQL team
COALESCE(e1, ..., en) returns the first non-null value and takes any number of arguments. Unlike NVL, it short-circuits, skipping later evaluations.
SELECT order_id,
COALESCE(shipped_date, promised_date, order_date) AS effective_date
FROM orders;Short-circuit evaluation
COALESCE stops at the first non-null argument and never evaluates the rest. NVL, by contrast, always evaluates both of its arguments before deciding which to return, even the one it discards. That matters when a later argument is an expensive or error-prone subquery: COALESCE(fast_column, (SELECT ... expensive lookup ...)) only runs the subquery for rows where fast_column is null.
COALESCE is ANSI-standard SQL and works unchanged on Postgres, SQL Server, and MySQL, while NVL is Oracle-only and capped at two arguments. Reach for COALESCE by default; use NVL2 only when you specifically need its null/not-null branching in one call.
Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free