SQL$HELP_OLD72.HLB  —  Conditional Expressions, NULLIF Expressions
    The NULLIF expression is used to substitute NULL when two value
    expressions are equal. For example, if the data stored in column
    ADDRESS_DATA_1 or ADDRESS_DATA_2 are space characters, the NULLIF
    expression replaces the space value with the NULL value.

    SQL> BEGIN
    cont>   INSERT INTO EMPLOYEES
    cont>     (EMPLOYEE_ID, LAST_NAME, FIRST_NAME,
    cont>      ADDRESS_DATA_1, ADDRESS_DATA_2)
    cont>   VALUES
    cont>     (:EMP_ID, 'Clinton', 'William',
    cont>      NULLIF(:ADD_1, ' '),
    cont>      NULLIF(:ADD_2, ' '));
    cont> END;
    SQL>
    SQL> SELECT LAST_NAME, ADDRESS_DATA_1, ADDRESS_DATA_2
    cont> FROM EMPLOYEES
    cont> WHERE EMPLOYEE_ID = :EMP_ID;
     LAST_NAME        ADDRESS_DATA_1              ADDRESS_DATA_2
     Clinton          NULL                        NULL
    1 row selected

    The following example substitutes NULL when the MIDDLE_INITIAL
    column of the EMPLOYEES table contains space characters:

    SQL> SELECT LAST_NAME,
    cont>   NULLIF (MIDDLE_INITIAL, ' '),
    cont>   FIRST_NAME
    cont> FROM EMPLOYEES
    cont> WHERE EMPLOYEE_ID IN ('00191', '00198');
     LAST_NAME               FIRST_NAME
     Pfeiffer         I      Karen
     Gehr             NULL   Leslie
    2 rows selected
Close Help