Solved

Commit/Rollback Transaction

Posted on 2007-11-14
1
2,750 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
1 Comment
 
LVL 9

Accepted Solution

by:
joebednarz earned 125 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now