-350 column-name WAS IMPLICITLY OR EXPLICITLY REFERENCED IN A CONTEXT IN WHICH IT CANNOT BE USED
Explanation
The SQL statement cannot be processed because it references a column in an invalid context.
- column-name
- The name of the column.
Possible reasons for this error include:
- DECFLOAT columns
- A DECFLOAT column cannot be:
- Specified as a column of a foreign key in a referential-constraint clause.
- Specified as a column of a parent key in a REFERENCES clause.
- Specified as a column of a partitioning key for range partitioning.
- Defined in a table that has an EDITPROC.
- The result data type of a key expression in an expression-based index must not be DECFLOAT or a distinct type based on the DECFLOAT data type. An intermediate result, of a key expression for an index can be the DECFLOAT data type or a distinct type based on the DECFLOAT data type.
- Specified as a column in a CREATE TABLE ORGANIZE BY HASH or ALTER TABLE ADD ORGANIZE BY HASH statement.
- LOB columns
- A LOB column cannot be:
- Defined in a temporary table (created global temporary table or declared global temporary table).
- Defined in an accelerator-only table.
- Defined in a table that has an edit procedure that is defined with row attribute sensitivity.
- Specified as a column of the primary key in a PRIMARY KEY clause.
- Specified as a column of a UNIQUE KEY.
- Specified as a column of a parent key in a REFERENCES clause.
Specified as a column of an index key. Additionally, the result data type, including the intermediate result, of a key-expression for an index cannot be a LOB data type or a distinct type based on a LOB data type. However, an inline LOB column is allowed in index-expression as the source of a SUBSTR function expression or as the first argument of the JSON_VAL function, and the LOB data type is allowed as the intermediate result of the expression.
Referenced in the first argument of the JSON_VAL function invocation in the index-expression of a CREATE INDEX statement, unless the column is defined as an inline LOB.
- Specified as a column of a partitioning key for range partitioning.
- Referenced by the definition of a column mask or a row permission.
- Defined as a column mask.
- Referenced in a period specification or period clause.
- Specified as a column in a CREATE TABLE ORGANIZE BY HASH or ALTER TABLE ADD ORGANIZE BY HASH statement.
- Hidden columns
- A hidden column cannot be specified in a key expression for an index.
- Result table columns
- A ROWID, LOB, or XML data type cannot be the data type of a column in the result table of an as-result-table clause of a CREATE TABLE or DECLARE GLOBAL TEMPORARY TABLE statement.
- A security label column column-name exists in the result table of the as-result-table clause; however, it is not the only security label column in that result table. A table can be defined only with a single security label column.
- Security label columns
- A security label column cannot be:
- Specified as a column of a foreign key in a referential-constraint clause.
- Specified in a REFERENCES clause.
- Specified in a key expression for an index.
- Timestamp with time zone columns
- A timestamp with time zone column cannot be specified as a column of a partitioning key for range partitioning.
- A Db2 11 Unicode column in an EBCDIC table
- A Db2 11 Unicode
column in an EBCDIC table cannot be specified in the following:
- An ALTER TABLE statement in an ADD COLUMN clause if the table is already defined with an EDITPROC.
- In a UNIQUE, PRIMARY KEY, REFERENCES, FOREIGN KEY, or ORGANIZE BY HASH clause.
This error can also be issued for the following:
- An EDITPROC clause cannot be specified if the table contains a Db2 11 Unicode column in an EBCDIC table.
- A value must not be specified after the DEFAULT keyword for a Db2 11 Unicode column in an EBCDIC table.
- NOT PADDED must not be specified for an index for an EBCDIC table if the table contains a Db2 11 Unicode column.
- A UNIQUE or PRIMARY KEY clause must not be specified for a Db2 11 Unicode column in an EBCDIC table.
- VARBINARY columns
- A VARBINARY column can not be specified as a column of an index key when DESC is also specified.
- XML columns
- An XML column cannot be:
- Specified as a column of the primary key in a PRIMARY KEY clause.
- Specified as a column of a UNIQUE KEY.
- Specified as a column of a foreign key in a referential-constraint clause.
- Specified as a column of a parent key in a REFERENCES clause.
- Specified as a column of a partitioning key for range partitioning.
- Defined in a temporary table (created global temporary table or declared global temporary table).
- Defined in a table that has an edit procedure that is defined with row attribute sensitivity.
- Specified as a column of an index key. Additionally, the result data type, including the intermediate result, of a key expression for an index cannot be an XML data type. For an XML index, only XML columns can be specified, and the result type of the index key can be DECFLOAT.
- Specified with the SET DEFAULT or DROP DEFAULT clause.
- Referenced by the definition of a column mask or a row permission.
- Defined as a column mask.
- Specified as a column in a CREATE TABLE ORGANIZE BY HASH or ALTER TABLE ADD ORGANIZE BY HASH statement.
- Specified in an ALTER TABLE statement in a DROP COLUMN clause.
- DOCID columns
- A DOCID column cannot be specified in the following:
- An ALTER TABLE statement in an ALTER COLUMN clause.
- An ALTER TABLE statement in a DROP COLUMN clause.
System action
The statement cannot be processed.
Programmer response
Correct the syntax, and resubmit the statement.
SQLSTATE
42962