Re: How do I make 2 + Null = 2 ?

From: Jan Overgaard <jo_at_cci.dk>
Date: 1996/02/16
Message-ID: <DMv1sE.AAt_at_cci.dk>#1/1


Use the NVL function that maps a null value to a defined value. The following is the printout from oracle help in sqlplus "help nvl".

SQL> help nvl

    NVL SYNTAX:
    NVL(expr1, expr2)

PURPOSE:
    If expr1 is null, returns expr2; if expr1 is not null, 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.

EXAMPLE:
    SELECT ename,
    NVL(TO_CHAR(COMM),'NOT APPLICABLE') "COMMISSION"

        FROM emp
        WHERE deptno = 30


    ENAME     COMMISSION
    --------- -----------
    ALLEN     300
    WARD      500
    MARTIN    1400
    BLAKE     NOT APPLICABLE
    TURNER    0
    JAMES     NOT APPLICABLE

SEE:
    NULL good luck

Jan Received on Fri Feb 16 1996 - 00:00:00 CET

Original text of this message