Skip to main content

NVL

Introduced or updated: v1.2.312

If <expr1> is NULL, returns <expr2>, otherwise returns <expr1>.

Syntax

NVL(<expr1>, <expr2>)

Aliases

Examples

SELECT NVL(NULL, 'b'), NVL('a', 'b');

┌────────────────────────────────┐
│ nvl(null, 'b') │ nvl('a', 'b')
├────────────────┼───────────────┤
│ b │ a │
└────────────────────────────────┘

SELECT NVL(NULL, 2), NVL(1, 2);

┌──────────────────────────┐
│ nvl(null, 2) │ nvl(1, 2)
├──────────────┼───────────┤
21
└──────────────────────────┘
Did this page help you?
Yes
No
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today