have two procedures that work that can called from trigger level within trigger. They passed a number of paramters including one temp-table containing create/delete information , the 2nd program accepts the current new record and the old record
WRITE TRIGGER
DEF TEMP-TABLE ttnewCustomer LIKE Customer.
CREATE ttnewcustomer.
BUFFER-COPY customer TO ttnewcustomer.
DEF TEMP-TABLE ttoldCustomer LIKE customer.
CREATE ttoldcustomer.
BUFFER-COPY oldcustomer TO ttoldCustomer.
RUN TrgWriteTransactionAS.p (input "WRITE", INPUT TABLE ttoldCustomer, "ttoldCustomer", INPUT TABLE ttnewCustomer, "ttnewCustomer").
The create/ delete procedure can be tested with the follwing
DEF TEMP-TABLE ttcustomer LIKE customer.
CREATE ttcustomer.
BUFFER-COPY customer TO ttcustomer.
run TrgCreateDeleteTransactionAS.p (input "CREATE", INPUT table ttcustomer, "ttcustomer").
just change 1st param to delete for delete trigger
anyway this works fine on sports db , any feedback would be welcome certainly not finished article , you will also have to create a history table. check definitions within assign statements
Jango
Attachment | Size |
---|---|
TrgCreateDeleteTransactionAS.p | 3.27 KB |
TrgWriteTransactionAS.p | 4.97 KB |