Hello,
Here is what I am trying to do: I have a table called tCase. Anytime a user tries to update specific fields in this table I want the information currently on the record to be written to a history table before the update is allowed.
I keep getting an error that my trigger is invalid and I can not seem to debug it. Here is my code:
CREATE OR REPLACE TRIGGER ECC.UPD_CASEEMPLOYMENT
BEFORE UPDATE OF EMPLOYERIDY,PERSONEMPLOYMENTIDY
ON ECC.TCASE
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
Insert into tCaseHistory (CASEHISTORYIDY,CASEIDY,PERSONEMPLOYMENTIDY,EMPLOYERIDY,USERNAME,RECORDDATE)
(select ld.CASEHISTORYIDY,ld.CASEIDY,ld.PERSONEMPLOYMENTIDY,ld.EMPLOYERIDY,ld.USERNAME,ld.RECORDDATE
from tcase
where caseidy = ld.caseidy);
END;
Can anyone help or point me in the right direction?
Thanks!
Here is what I am trying to do: I have a table called tCase. Anytime a user tries to update specific fields in this table I want the information currently on the record to be written to a history table before the update is allowed.
I keep getting an error that my trigger is invalid and I can not seem to debug it. Here is my code:
CREATE OR REPLACE TRIGGER ECC.UPD_CASEEMPLOYMENT
BEFORE UPDATE OF EMPLOYERIDY,PERSONEMPLOYMENTIDY
ON ECC.TCASE
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
Insert into tCaseHistory (CASEHISTORYIDY,CASEIDY,PERSONEMPLOYMENTIDY,EMPLOYERIDY,USERNAME,RECORDDATE)
(select ld.CASEHISTORYIDY,ld.CASEIDY,ld.PERSONEMPLOYMENTIDY,ld.EMPLOYERIDY,ld.USERNAME,ld.RECORDDATE
from tcase
where caseidy = ld.caseidy);
END;
Can anyone help or point me in the right direction?
Thanks!