Skip to main content

Posts

Showing posts with the label Rollback

Question: 14: Drop Table - Dependency

Evaluate the SQL statement DROP TABLE DEPT Which four statements are true of the SQL statement? A. You cannot roll back this statement. B. All pending transactions are committed. C. Al views based on the DEPT table are deleted. D. All indexes based on the DEPT table are dropped. E. All data in the table is deleted, and the table structure is also deleted. F.All data in the table is deleted, but the structure of the table is retained. G.All synonyms based on the DEPT table are deleted. Answer: A, B, D and E Explanation: A. You cannot roll back DROP TABLE statement. B. All pending transactions related on this table arecommitted. D. If the table is dropped, Oracle automatically drops any index, trigger and constraintassociated with the table as well. E. All data in the table is deleted, and the table structure is also deleted. Incorrect Answers C: All views based on the DEPT table become invalid, but they are not deleted. F: All data in the table is deleted, and the table structure is als...

Question 12: What is PRAGMA AUTONOMOUS_TRANSACTION?

You are running a pl/sql block or procedure called parent In that procedure you called another one procedure namely child and that procedure contains commit statement. After calling the child procedure the transactions done in parent procedure are also committed due to the child procedure commit statement. But you want to rollback or commit the parent procedure whole transactions based on your requirement after the calling procedure child. In this situation, you should add the "pragma autonomus transaction" in child procedure. If you add this statement then it acts as a separate. If you use commit in child procedure it will not affect the parent procedure. Example : CREATE OR REPLACE PROCEDURE parent() AS BEGIN UPDATE tab1 SET fieldname = value WHERE condition; UPDATE tab2 SET fieldname = value WHERE condition; child(); UPDATE tab4 SET fieldname = value WHERE condition; IF parentcondition COMMIT; ELSE ROLLBACK; END IF; END. CREATE OR REPLACE PROCEDURE child() AS PRAGMA AUTONO...