Is COMMIT required after every EXECUTE IMMEDIATE?

前端 未结 2 1612
死守一世寂寞
死守一世寂寞 2021-02-14 09:48

I have multiple EXECUTE IMMEDIATE commands within one oracle procedure.

EXECUTE IMMEDIATE \'DELETE  FROM tbl1\'; 
EXECUTE IMMEDIATE \'INSERT INTO tbl1...\'; 
COM         


        
2条回答
  •  不思量自难忘°
    2021-02-14 10:12

    Commit is not required after every EXECUTE IMMEDIATE. Certain statements do NOT require a commit; for example, if you truncate a table with TRUNCATE. The truncation is done and there is no need for a commit. no ROLLBACK either. You need to know that COMMIT and ROLLBACK are session attributes. All uncommitted work within the current transaction are committed or rolled back - not just the statement executed by the EXECUTE IMMEDIATE.

提交回复
热议问题