Skip to content

Latest commit

 

History

History
69 lines (43 loc) · 1.6 KB

ASSERT_COLUMN_EXISTS.rst

File metadata and controls

69 lines (43 loc) · 1.6 KB

ASSERT_COLUMN_EXISTS procedure

Raises an assertion error if the specified column doesn't exist.

Prototypes

ASSERT_COLUMN_EXISTS(ASCHEMA VARCHAR(128), ATABLE VARCHAR(128), ACOLNAME VARCHAR(128))
ASSERT_COLUMN_EXISTS(ATABLE VARCHAR(128), ACOLNAME VARCHAR(128))

Description

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.

Parameters

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.

Examples

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

See Also

  • Source code
  • ASSERT_TABLE_EXISTS
  • ASSERT_TRIGGER_EXISTS
  • ASSERT_ROUTINE_EXISTS
  • ASSERT_FAILED_STATE