?
Solved

Execute immediate will auto commit sql statement before

Posted on 2007-11-25
1
Medium Priority
?
12,344 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
[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 13

Accepted Solution

by:
sonicefu earned 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that useā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

764 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