I have a external rpgle trigger(MYTRIGR) right now that is applied to a table(MYTABLE and it has 276 fields in it). I have been reading the Modernization Redbook, and found a great tip that I want to implement in section 8.4.2. This particular table is VERY difficult to get an exclusive lock on. So we want to create an SQL trigger(MYTRIGS) on the table and then turn our existing rpgle trigger(MYTRIGR) into a stored procedure(MYTRIGP) so that we can make updates to the stored procedure without having to have the lock. I have been reading the Stored Proc/Trigger/ and UDF redbook as well.
What I haven't found yet is how to push the before and after(old row and new row) to the stored procedure. Can anyone help me? Here is what I have so far...
This is the SQL Trigger
Here is the External Stored Procedure
I don't want to have to send each field to the stored proc, and I don't want any logic processing in the trigger. This way changes can be made as needed without having to get a lock on the table.
What I haven't found yet is how to push the before and after(old row and new row) to the stored procedure. Can anyone help me? Here is what I have so far...
This is the SQL Trigger
Code:
CREATE OR REPLACE TRIGGER MYTRIGS
AFTER INSERT ON MYTABLE
REFERENCING NEW ROW AS NEW_ROW
OLD ROW AS OLD_ROW
FOR EACH ROW MODE DB2ROW
BEGIN
CALL MYTRIGP( NEW_ROW, OLD_ROW );
END
Code:
CREATE OR REPLACE PROCEDURE MYTRIGP ( IN NEW_ROW [COLOR="#FF0000"]?????[/COLOR], IN OLD_ROW [COLOR="#FF0000"]?????[/COLOR] ) LANGUAGE RPGLE SPECIFIC MYTRIGP EXTERNAL NAME MYLIB/MYTRIGR PARAMETER STYLE GENERAL





Comment