NULL Statement

The NULL statement is a no-op (no operation); it passes control to the next statement without doing anything. In the body of an IF-THEN clause, a loop, or a procedure, the NULL statement serves as a placeholder. For more information, see "Using the NULL Statement".


null statement ::=

Description of null_statement.gif follows
Description of the illustration null_statement.gif

Usage Notes

The NULL statement improves readability by making the meaning and action of conditional statements clear. It tells readers that the associated alternative has not been overlooked: you have decided that no action is necessary.

Certain clauses in PL/SQL, such as in an IF statement or an exception handler, must contain at least one executable statement. You can use the NULL statement to make these constructs compile, while not taking any action.

You might not be able to branch to certain places with the GOTO statement because the next statement is END, END IF, and so on, which are not executable statements. In these cases, you can put a NULL statement where you want to branch.

The NULL statement and Boolean value NULL are not related.


For examples, see the following:

Example 1-12, "Creating a Stored Subprogram"
Example 1-16, "Declaring a Record Type"
Example 4-20, "Using a NULL Statement to Allow a GOTO to a Label"
Example 4-22, "Using the NULL Statement to Show No Action"
Example 4-23, "Using NULL as a Placeholder When Creating a Subprogram"

Related Topics

"Sequential Control: GOTO and NULL Statements"