Solved

Execute immediate will auto commit sql statement before

Posted on 2007-11-25
1
11,366 Views
Last Modified: 2013-12-07
Is Execute immediate will commit the update statement execute before?
In the example below when error happen when execute procedure Proc_1 at update table2, i notice that the update statement for table1 has been committed. If i uncomment the execute immediate statement, update table1 will not commit, anyone knows why this happen?

CREATE OR REPLACE Procedure Proc_1 As
 Begin
        -- UPDATE Table  1      
        Update table1 Set col1 = 'Col1';
       
      -- Execute immediate
       execute immediate ('Alter trigger trigger1 disable');
       
        -- Update Table 2      
        Update Table2 Set col2 = 'Col2';
        Commit;
     End If;
  Exception
     When others Then
      Rollback;
       Raise_application_error(-20747, Sqlcode || ' ' || Sqlerrm);
End;
0
Comment
Question by:yuching
1 Comment
 
LVL 13

Accepted Solution

by:
sonicefu earned 125 total points
ID: 20348524
No, execute immediate does not commit automatically. In your example update in table1 was commited due to DDL statement (Alter trigger trigger1 disable). DDL statements commit previously executed DML statements whether DDL statement successfully executed or not.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

760 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

19 Experts available now in Live!

Get 1:1 Help Now