The keyword NULL is not the same marker that the system stores to indicate missing information. The keyword NULL is similar to a literal and represents the SQL null placeholder for a value in an SQL request.
Rules for Using NULL as a Literal
The literal NULL can be used in the following ways.
- As a CAST source operand, for example.
CAST (NULL AS value) - As a CASE result, for example.
CASE expression THEN NULL END
or
CASE expression THEN expression ELSE NULL END
- As an item specifying a null is to be placed in a column on INSERT or UPDATE.
- As a default column definition specification, for example.
DEFAULT NULL
- As an explicit SELECT item, for example.
SELECT NULL
This usage, which does not specify a FROM clause, is a Teradata extension to the ANSI/ISO SQL-2008 standard.
- As an operand of a function, for example.
SELECT TYPE(NULL)
This usage, which does not specify a FROM clause, is a Teradata extension to the ANSI/ISO SQL-2008 standard.
Data Type of NULL Literals
When you use NULL as an explicit SELECT item or as the operand of a function, its data type is INTEGER. For example, if you perform SELECT TYPE(NULL), the data type of NULL is returned as INTEGER.
In all other cases, NULL has no data type because NULL has no value.