crusaderky
crusaderky

Reputation: 2692

Do I need to COMMIT when interleaving DDLs and DMLs?

In Oracle, I am invoking the following querys (not from sqlplus) as part of an installation script:

ALTER TABLE MYTABLE DISABLE CONSTRAINT PFTATTRS_ATTR_FK;
INSERT INTO MYTABLE (PTF_ID, ATTR_ID) VALUES (1, 5);
ALTER TABLE MYTABLE ENABLE CONSTRAINT PFTATTRS_ATTR_FK;

As you see I'm interleaving DMLs (that require COMMIT) with DDLs (that are auto-committed). My doubt is: do I need to commit the DMLs before every DDL, or is it safe to do one big commit at the end of my script?

Upvotes: 0

Views: 259

Answers (1)

peter.petrov
peter.petrov

Reputation: 39477

See here.

http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:7072180788422

https://community.oracle.com/message/10310617

Each DDL statement will commit all previous uncommitted DML statements.

Upvotes: 5

Related Questions