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
Can u please explain me the Discussion on Except ,using cast like type cast. Question in the context of difference between two tables
Explain the use of file option in exp command.
How to filter out duplications in the returning rows using oracle?
What is the effect of setting the value "all_rows" for optimizer_goal parameter of the alter session command? What are the factors that affect optimizer in choosing an optimization approach?
Write a trigger example in oracle?
HI, Please let me know the syllabus for Oracle OCA and OCP Certification
why should i declare foreign key constraint as self relation instead of binary relation in tables ?
What is oracle thin client?
How to create a new table in your schema?
1) Does oracle have any table which contain all the exceptions and it's code internally?
Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.
Explain the truncate in oracle?
How to assign data of the deleted row to variables?
Give the advantages and disadvantages of clusters.
How to invoke the original export import utilities?