SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
9-124
Example of NVL
Example of NVL
This function replaces all NULL values with ‘two’.
create table tab1 (colA varchar(10), colB int);
insert into tab1 values('one',1);
-- The default value for colA is NULL.
insert into tab1(colB) values(2);
insert into tab1 values('three',3);
insert into tab1 values('four',4);
select colA, colB, NVL(colA, 'two') from tab1;
COLA COLB (EXPR)
---------- ----------- ----------
one 1 one
? 2 two
three 3 three
four 4 four
--- 4 row(s) selected.
Note. Existing NonStop SQL/MX conversions rules are applied to the above
rules.