Is COMMIT required after every EXECUTE IMMEDIATE?

I have several EXECUTE IMMEDIATE commands in one oracle procedure. A.

EXECUTE IMMEDIATE 'DELETE  FROM tbl1'; 
EXECUTE IMMEDIATE 'INSERT INTO tbl1...'; 
COMMIT;
EXECUTE IMMEDIATE 'DELETE  FROM tbl3'; 
EXECUTE IMMEDIATE 'INSERT INTO tbl3 ...'; 
COMMIT;
EXECUTE IMMEDIATE 'DELETE  FROM tbl4'; 
EXECUTE IMMEDIATE 'INSERT INTO tbl4 ...';
COMMIT; 

Do I need all these COMMITs or only at the end of the procedure?

+4
source share
2 answers

The only cases when you are really forced to make transactions, others at the end of a business transaction:

  • When executing DDL: DDL execution is assured of a pair of implicit commits.
  • After directly inserting the path: the table cannot be read until the insert is committed.

- - . , , - (, INVOICE INVOICE_DETAIL).

+7

Commit EXECUTE IMMEDIATE. ; , TRUNCATE. , . ROLLBACK. , COMMIT ROLLBACK . - , EXECUTE IMMEDIATE.

+4

All Articles