Oracle Consulting Oracle Training Oracle Support Development
Home
Catalog
Oracle Books
SQL Server Books
IT Books
Job Interview Books
eBooks
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

   
 

ss

Oracle Tips by Burleson 

SAVEPOINT

A SAVEPOINT is a marker within a transaction that allows for a partial rollback.  As changes are made in a transaction, we can create SAVEPOINTs to mark different points within the transaction.  If we encounter an error, we can rollback to a SAVEPOINT or all the way back to the beginning of the transaction. 

SQL> INSERT INTO AUTHOR
  2  VALUES ('A11l', 'john',
  3          'garmany', '123-345-4567',
  4          '1234 here st', 'denver',
  5          'CO','90204', '9999');
1 row created.
SQL> savepoint in_author;
Savepoint created.
SQL> INSERT INTO BOOK_AUTHOR VALUES ('A111', 'B130', .20); 
1 row created.
SQL> savepoint in_book_author;
Savepoint created.
SQL> INSERT INTO BOOK
  2  VALUES ('B130', 'P002', 'easy oracle sql',
  3          'miscellaneous', 9.95, 1000, 15, 0, '',
  4          to_date ('02-20-2005','MM-DD-YYYY'));
1 row created.
SQL> rollback to in_author;
Rollback complete. 

In the example above, I inserted a row into the AUTHOR table and created a SAVEPOINT called in_author.  Next, I inserted a row into the book_author table and created another SAVEPOINT called in_book_author.  Finally, I inserted a row in the BOOK table.  I then issued a ROLLBACK to in_author.  At this point, the row inserted into the AUTHOR table is still there and not committed.  The rows added to the book and book_author tables have been discarded. At this point, I can continue to make changes, issue a ROLLBACK to the start of the transaction, or issue a COMMIT and commit the row in the author table.


The above book excerpt is from:

Easy Oracle SQL

Get Started Fast writing SQL Reports with SQL*Plus

ISBN 0-9727513-7-8

John Garmany 

http://www.rampant-books.com/book_2005_1_easy_sql.htm

Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster



Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   

 

   

 Copyright © 1996 -2016 by Burleson. All rights reserved.


Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks