If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > calling stored procedure from trigger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-16-04, 13:16
craigmc craigmc is offline
Registered User
 
Join Date: Aug 2003
Location: austin,tx
Posts: 90
calling stored procedure from trigger

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
Reply With Quote
  #2 (permalink)  
Old 04-16-04, 13:23
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: calling stored procedure from trigger

Calling a Stored Procedure from a Trigger is not supported in DB2 on Unix and windows

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On