Connecting Tech Pros Worldwide Forums | Help | Site Map

how i create a delete trigger that will save the deleted row into another table, like

Newbie
 
Join Date: Jan 2007
Location: London
Posts: 1
#1: Jan 5 '07
I have two tables.
Table ATRIG contain data Say(Snum, Name, Grade)
an other table BTRIG, which is empty so that any deleted rows from table ATRIG is automatically saved to BTRIG.
I need to use delete trigger. for this using trigger action after deleting the row..
any help is appreciated.

Member
 
Join Date: Sep 2006
Posts: 50
#2: Jan 9 '07

re: how i create a delete trigger that will save the deleted row into another table, like


Try this trigger :-

CREATE OR REPLACE TRIGGER TRG_ATRIG
AFTER DELETE ON ATRIG FOR EACH ROW
BEGIN

If DELETING Then

INSERT INTO BTRIG (Snum, Name, Grade)
VALUES(:OLD.SNUM, :OLD.NAME, :OLD.GRADE) ;

END IF;

END;

Regards
Reshmi

Quote:

Originally Posted by nomi121

I have two tables.
Table ATRIG contain data Say(Snum, Name, Grade)
an other table BTRIG, which is empty so that any deleted rows from table ATRIG is automatically saved to BTRIG.
I need to use delete trigger. for this using trigger action after deleting the row..
any help is appreciated.

Reply