Using the DEFAULT function can result in an error when any of the following conditions are true:
- The column name is omitted and Teradata Database cannot derive the column context
- The DEFAULT function appears in a partitioning expression for defining PPIs
- The column name is omitted and the DEFAULT function appears in an expression that does not support the DEFAULT function without a column name
- The DEFAULT function appears in an expression for which the result type is incompatible
For example, consider the following table definition:
CREATE TABLE Parts_Table (Part_Code INTEGER DEFAULT 9999 ,Part_Name CHAR(20) );
The following statement results in an error because the result type of the DEFAULT function is not compatible with the column to which the result is being compared:
SELECT * FROM Parts_Table WHERE Part_Name = DEFAULT(Part_Code);