Definition:
NULL values represent missing or unknown data. NULL values are used as placeholders or as the default entry in columns to indicate that no actual data is present. The NULL is untyped in SQL, meaning that it is not an integer, a character, or any other specific data type.
Note that NULL is not the same as an empty data string or the numerical value '0'. While NULL indicates the absence of a value, the empty string and numerical zero both represent actual values.
While a NULL value can be assigned, it can not be equated with anything, including itself.
Because NULL does not represent or equate to a data type, you cannot test for NULL values with any comparison operators, such as =, <, or <>.
The IS NULL and IS NOT NULL operators are used to test for NULL values.
Example Syntax:
Testing a value for NULL:
UPDATE test
SET test1 = '2'
WHERE test2 IS NULL;
Updating a column so that it does not contain a value:
UPDATE test
SET test1 = NULL
WHERE ROWNUM = 1;
Using NULL as part of the WHERE clause criteria in a DELETE statement:
DELETE FROM test
WHERE first_name IS NULL;
Related Links:
Related Code Snippets: