I have been tasked with creating a DB2 trigger to execute a stored procedure whenever a row is updated, added or deleted from several DB2 tables.
You should be able to pass the data you need from the trigger to your stored procedure. Just make sure that you build the stored procedure to accept the appropriate parameters, then send the correct data from within your trigger when you call the stored procedure.
IBM ships several examples of stored procedures with DB2. You should be able to find them in the sample library at your shop. Consult you DBA team to gain access to this code.
Editor's note: Do you agree with this expert's response? If you have more to share, post it in one of our
Since the stored procedure needs to operate on several tables I need to know if a trigger can pass parameters. Potential parms would be table name, action taken (update/delete/etc...), column changed with before and after value, etc. Although I have used DB2 for several years, triggers and stored procedures are new for me. We recently converted to DB2v7, approximately eight months ago. Do you know where I could find examples of this? I have started looking at the DB2 Developers Guide, 4th ed.
Dig Deeper on IBM DB2 management
Our expert suggests that the best way to pass the SAP BW exam is to have hands-on job experience. But that's not all he has to say about ...
To export data from a DB2 table to a flat file, you need to run an export specifying the proper file format. The export utility exports data from a ...
Craig Mullins recommends two specific resources for learning how to create and support Binary Large Objects (BLOB) in DB2.