Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Commit/Rollback Transaction

Posted on 2007-11-14
1
Medium Priority
?
2,791 Views
Last Modified: 2013-12-07
I have the following code for an MS SQL transaction and I want to do the same thing from oracle but am having a hard time w/ the commit/rollback.  

begin try
      begin transaction
            insert statement
            delete statement
      commit transaction
end try

begin catch
    rollback transaction
    print (@@ERROR)
end catch



0
Comment
Question by:ndwHombre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
joebednarz earned 500 total points
ID: 20281852
There are many ways to accomplish this in Oracle... here is one:

BEGIN

   SET TRANSACTION NAME 'my_tx';

   BEGIN
      INSERT statement
      DELETE statement
      COMMIT;
   EXCEPTION WHEN <some condition> THEN
      ROLLBACK;
   END;

END;

Some other things to look into:  SAVEPOINT, PRAGMA AUTONOMOUS_TRANSACTION
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question