I'm a DB2 newbie trying to call a stored procedure from a trigger.
The stored procedure allocates a key which I need to set in my table.
The procedure header looks like this:
CREATE PROCEDURE mySchema.SP_GetKey_Param (
IN v_objname VARCHAR(30),
INOUT v_New_Key VARCHAR(32)
DYNAMIC RESULT SETS 1
LANGUAGE SQL
...
Here's the trigger I'm trying to get working. I'm not sure of any of the syntax. Im getting the error:
'An unexpected token "CALL" ...' when I try to define it.
CREATE TRIGGER mySchema.TT_TEST_TABLE_INS
BEFORE INSERT ON mySchema.TT_TEST_TABLE
REFERENCING NEW AS inserted
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
DECLARE newKey VARCHAR(20) ;
CALL mySchema.SP_GETKEY_PARAM ( 'TT_TEST_TABLE', newKey ) ;
SET inserted.keyField = newKey ;
END
Any assistance is greatly appreciated. I'm using DB2 UDB 8.1 PE.
-Craig