March 28, 2013 at 6:09 am
Hi Team,
Am a sql developer and new to oracle, i was assinged a trigger for
am having two tables
Table1 : Test
Cols : ID | DESC
Table2: TEST_CUST
Cols : MID | STATUS
and i want a update in third table "S_ID" when an insert | Delete | Udpate happends on Table1.
Table3 : SID
Cols : M_ID | STATUS
CREATE OR REPLACE TRIGGER TRG_TEST
AFTER INSERT OR UPDATE OR DELETE
OF ID,DESC
ON TEST
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
UPDATE S_ID SET STATUS ='Y'
WHERE SID in
(SELECT SID FROM TEST_CUST WHERE M_ID=:old."ID");
END;
--
But am gettting error "A mutation table is defined as a table that is changing"
need your help please...
March 28, 2013 at 6:12 am
your trigger is on the table TEST, but the update command is looking at a different table;
UPDATE S_ID SET STATUS ='Y'
WHERE SID in
(SELECT SID FROM TEST_CUST WHERE M_ID=:old."ID");
shouldn't that be TEST and not TEST_CUST?
otehrwise, you need to join TEST to TEST_CUST, and update SID from that combined results.
Lowell
March 28, 2013 at 6:30 am
My requirement is when ever any insert|update|delete happens on Table1:Test,
then it should check the ID value in table SID, if ID is avaiale then update the column "status" to Y
can u please help in providing the query...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy