Answer Posted / guru
----------- without AUTONOMOUS_TRANSACTION
CREATE or REPLACE TRIGGER parts_trig
BEFORE INSERT ON parts
FOR EACH ROW
BEGIN
INSERT INTO parts_log VALUES(:new.pnum, :new.pname);
END;
/
INSERT INTO parts VALUES (1040, 'Head Gasket');
COMMIT;
INSERT INTO parts VALUES (2075, 'Oil Pan');
ROLLBACK;
SELECT * FROM parts ORDER BY pnum;
SELECT * FROM parts_log ORDER BY pnum;
----------- using AUTONOMOUS_TRANSACTION
CREATE or REPLACE TRIGGER parts_trig
BEFORE INSERT ON parts FOR EACH ROW
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO parts_log VALUES(:new.pnum, :new.pname);
COMMIT; -- only for AUTONOMOUS_TRANSACTION
END;
/
INSERT INTO parts VALUES (1040, 'Head Gasket');
COMMIT;
INSERT INTO parts VALUES (2075, 'Oil Pan');
ROLLBACK;
/
Please Check This
Thanks
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
 What are the oracle DML commands possible through an update strategy?
What is a synonym? What are its various types?
How many types of synonyms in Oracle?
How to increment dates by 1 in oracle?
defination of bitmap index
How to check the oracle tns settings?
What is set verify off in oracle?
what is partitioning? Types of partitioning. explain? what is the new kind of partitioning type introduced in 9i?
Briefly explain what is literal? Give an example where it can be used?
how can db_files > maxdatafiles since db_files is for instance and the later is for database
List out the components of logical database structure of oracle database.
What is a oracle database?
How do I find my oracle client driver version?
What are the components of logical database structure in oracle database?
How to define an oracle cursor variable?