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 > How do you call a stored procedure using a trigger?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-24-03, 04:23
bgdeepak bgdeepak is offline
Registered User
 
Join Date: Sep 2003
Posts: 14
How do you call a stored procedure using a trigger?

How do you call a stored procedure using a trigger?
On insertion of a record into the table the trigger should call a stored procedure.How do we go about doing this..

Thanks,
Deepak B G
Reply With Quote
  #2 (permalink)  
Old 11-24-03, 04:38
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: How do you call a stored procedure using a trigger?

As far as I remember, as of now , you cannot call a SP from a trigger in DB2 LUW ... DB2 for z/os permits this ..

My apologies if I'm wrong

Sathyaram

Quote:
Originally posted by bgdeepak
How do you call a stored procedure using a trigger?
On insertion of a record into the table the trigger should call a stored procedure.How do we go about doing this..

Thanks,
Deepak B G
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 12-01-03, 08:01
mullendb mullendb is offline
Registered User
 
Join Date: Dec 2003
Posts: 1
call a SP from a DB2 trigger example

IBM 390 MF using DB2 Vr 7.2.01

try this for the TRIGGER

CREATE TRIGGER subsystem.trigger-name AFTER UPDATE
ON subsystem.table-name
REFERENCING OLD AS OLD
NEW AS NEW
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
CALL subsystem.procedure-name (
NEW.column_value1,
OLD.column_value1,
CURRENT TIMESTAMP,
);
END

you don't need the "current timestamp" but I just put it in there to show it can be done.
AFTER UPDATE can be changed to BEFORE UPDATE if you want

we've just successfuly done this.
using a DB2 trigger, call a DB2 Stored procedure written in COBOL.
what a pain in the @#$@#..

the only down side is I'm having problems "calling" other existing COBOL programs.. without this, I'm not sure what value these will add to our systems.
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