Using IS NULL

From InterBase

Go Up to Using Comparison Operators in Expressions


IS NULL tests for the absence of a value in a column. The complete syntax of the IS NULL clause is:

<value> IS [NOT] NULL

For example, the following cursor retrieves the names of employees who do not have phone extensions:

EXEC SQL
DECLARE MISSING_PHONE CURSOR FOR
SELECT LAST_NAME, FIRST_NAME
FROM EMPLOYEE
WHERE PHONE_EXT IS NULL;

Use IS NOT NULL to test that a column contains a value. For example, the following cursor retrieves the phone numbers of all employees that have phone extensions:

EXEC SQL
DECLARE PHONE_LIST CURSOR FOR
SELECT LAST_NAME, FIRST_NAME, PHONE_EXT
FROM EMPLOYEE
WHERE PHONE_EXT IS NOT NULL
ORDER BY LAST_NAME, FIRST_NAME;

Advance To: