• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 13369
  • Last Modified:

Execute immediate will auto commit sql statement before

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
        -- UPDATE Table  1      
        Update table1 Set col1 = 'Col1';
      -- Execute immediate
       execute immediate ('Alter trigger trigger1 disable');
        -- Update Table 2      
        Update Table2 Set col2 = 'Col2';
     End If;
     When others Then
       Raise_application_error(-20747, Sqlcode || ' ' || Sqlerrm);
1 Solution
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now