Raises an assertion error if the specified column doesn't exist.
ASSERT_COLUMN_EXISTS(ASCHEMA VARCHAR(128), ATABLE VARCHAR(128), ACOLNAME VARCHAR(128))
ASSERT_COLUMN_EXISTS(ATABLE VARCHAR(128), ACOLNAME VARCHAR(128))
Raises the ASSERT_FAILED_STATE
state if ACOLNAME does not exist in the table specified by ASCHEMA and ATABLE. If not specified, ASCHEMA defaults to the value of the CURRENT SCHEMA special register.
- ASCHEMA
Specifies the schema containing the table to check. If omitted, defaults to the value of the CURRENT SCHEMA special register.
- ATABLE
Specifies the name of the table to check.
- ACOLNAME
Specifies the name of the column to test for existence.
Test the TABNAME column exists in the SYSCAT.TABLES view:
CALL ASSERT_COLUMN_EXISTS('SYSCAT', 'TABLES', 'TABNAME');
Test the existence of a made-up column in the SYSCAT.TABLES view:
CALL ASSERT_COLUMN_EXISTS('SYSCAT', 'TABLES', 'FOO');
SQL0438N Application raised error or warning with diagnostic text: "FOO
does not exist in SYSCAT.TABLES ". SQLSTATE=90001
- Source code
ASSERT_TABLE_EXISTS
ASSERT_TRIGGER_EXISTS
ASSERT_ROUTINE_EXISTS
ASSERT_FAILED_STATE