Oracle9i SQL Reference Release 1 (9.0.1) Part Number A90125-01 |
|
Functions, 86 of 166
nvl::=
nvl
If expr1 is null, NVL
returns expr2. If expr1 is not null, NVL
returns expr1. The arguments expr1 and expr2 can have any datatype. If their datatypes are different, Oracle converts expr2 to the datatype of expr1 before comparing them.
The datatype of the return value is always the same as the datatype of expr1, unless expr1 is character data, in which case the return value's datatype is VARCHAR2
and is in the character set of expr1.
The following example returns a list of employee names and commissions, substituting "Not Applicable" if the employee receives no commission:
SELECT last_name, NVL(TO_CHAR(commission_pct), 'Not Applicable') "COMMISSION" FROM employees WHERE last_name LIKE 'B%'; LAST_NAME COMMISSION ------------------------- ---------------------------------------- Baer Not Applicable Baida Not Applicable Banda .11 Bates .16 Bell Not Applicable Bernstein .26 Bissot Not Applicable Bloom .21 Bull Not Applicable
|
![]() Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|