InterviewSolution
Saved Bookmarks
| 1. |
How to commit a transaction in PL/SQL? |
|
Answer» A transaction in PL/SQL is an ATOMIC unit that may consist of one or more related SQL statements. To commit a transaction in PL/SQL, use the COMMIT command: COMMIT;The COMMIT statement saves all the changes since the last COMMIT or ROLLBACK. An explicit or implicit REQUEST is made to commit a transaction. Let’s say the following is the INSERT in the table. At the END, execute the COMMIT command if you want to commit the transaction: INSERT INTO DEPTBUDGET (DEPTID,DEPTNAME,DEPTLOC) VALUES (1, 'Finance', 'NORTH'); INSERT INTO DEPTBUDGET (DEPTID,DEPTNAME,DEPTLOC) VALUES (2, 'Marketing', 'EAST'); INSERT INTO DEPTBUDGET (DEPTID,DEPTNAME,DEPTLOC) VALUES (3, 'Operations', 'WEST'); COMMIT; |
|