Thursday, 28 July 2011

Create trigger from DB2 control center command editor

When creating a trigger from DB2 control center command editor, make sure to change the statement terminator character from semicolon (which is default) to something else e.g. “,”. The semicolon is used to separate trigger SQL statements and using it as a terminator character will cause a problem in interpreting the trigger SQL statements.

If you don't change it you can see the following errors when trying to create a trigger:

DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "END-OF-STATEMENT" was found following
"get_store_id integer". Expected tokens may include: "<psm_semicolon>".
LINE NUMBER=6. SQLSTATE=42601


and/or

DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "END-OF-STATEMENT" was found following "END".
Expected tokens may include: "JOIN <joined_table>". SQLSTATE=42601

SQL0104N An unexpected token "END-OF-STATEMENT" was found following "END". Expected tokens may include: "JOIN <joined_table> ".

You can easily change it within the command editor from the small text box at the bottom of the editor as shown below.

DB2 Control Center

No comments:

Post a Comment