Committing and Rolling Back Transactions

As you learned earlier in this chapter, a database transaction is a unit of work performed by one or more closely related SQL statements. The following hands-on exercise teaches you how to commit or roll back a transaction.

EXERCISE 3.21: Committing and Rolling Back Transactions

Enter the following series of related SQL statements, which together form a transaction that inserts a new order into the ORDERS table and two associated line items into the ITEMS table:

INSERT INTO orders
 (id, c_id, orderdate, shipdate, paiddate, status)
  VALUES (15, 3, TO_DATE('23-JUN-2006','DD-MON-YYYY'),
          TO_DATE('23-JUN-2006','DD-MON-YYYY'), NULL, 'F');
INSERT INTO items (o_id, id, p_id, quantity) VALUES (15, 1, 4, 1); INSERT ...

Get Hands-On Oracle Database 10g Express Edition for Windows now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.