Access the answers to your technology questions today.
Subscribe Now
30-day free trial. Register in 60 seconds.
What Makes Experts Exchange Unique?
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.
Try it out and discover for yourself.
Subscribe Now
30-day free trial. Register in 60 seconds.
Join the Community
Give a Little. Get a Lot.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Join the Community
by: geotigerPosted on 2005-04-28 at 06:44:02ID: 13885485
See the following example:
CREATE OR REPLACE TRIGGER TRG$my_trigger
AFTER INSERT OR DELETE OR UPDATE ON my_table
FOR EACH ROW
DECLARE
v_operation VARCHAR2(10) := NULL;
BEGIN
IF INSERTING THEN
v_operation := 'INS';
ELSIF UPDATING THEN
v_operation := 'UPD';
ELSE
v_operation := 'DEL';
END IF;
IF INSERTING OR UPDATING THEN
INSERT INTO AUD$my_table (
CLIENT,
...
AUDIT_ACTION,
AUDIT_DTM,
AUDIT_USER
) VALUES (
:new.CLIENT,
...
v_operation,
SYSDATE,
USER
);
ELSE
INSERT INTO AUD$my_table (
CLIENT,
...
AUDIT_ACTION,
AUDIT_DTM,
AUDIT_USER
) VALUES (
:old.CLIENT,
...
v_operation,
SYSDATE,
USER
);
END IF;
END;