DB2 Version 10.1 for Linux, UNIX, and Windows

NULL statement (PL/SQL)

The NULL statement is an executable statement that does nothing. The NULL statement can act as a placeholder whenever an executable statement is required, but no SQL operation is wanted; for example, within a branch of the IF-THEN-ELSE statement.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-NULL--------------------------------------------------------><

Examples

The following example shows the simplest valid PL/SQL program that the DB2® data server can compile:
BEGIN
    NULL;
END;
The following example shows the NULL statement within an IF...THEN...ELSE statement:
CREATE OR REPLACE PROCEDURE divide_it (
    p_numerator     IN  NUMBER,
    p_denominator   IN  NUMBER,
    p_result        OUT NUMBER
)
IS
BEGIN
    IF p_denominator = 0 THEN
        NULL;
    ELSE
        p_result := p_numerator / p_denominator;
    END IF;
END;