📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

NVL



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 │ └──────────────────────────┘

Was this page helpful?