Solved

Execute immediate will auto commit sql statement before

Posted on 2007-11-25
1
11,571 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.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

831 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