Information générale
Catégorie:
Déclencheurs, séquences et procédures stockées
>Hi guys,
>
>I need to create a very simple trigger, but i am getting an error. :(
>
>The trigger must do the following: when a record is updated on table X, it must be also inserted into another table called Y, that has the same structure that table X plus a varchar2(10) field.
Off the top of my head ...
CREATE OR REPLACE Trigger myTrigger
BEFORE INSERT OR UPDATE ON X
FOR EACH ROW
BEGIN
insert into y (columname) values (:new.columname);
COMMIT;
--don't know if you need commit or not (can't remember..)
END;
/
SHO ERR
Can get trickier if you need to rollback transactions for example on the y table when an error occurs on the x table.
Otherwise post you code and error.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement