Oracle: DDL and transaction rollback

Just discovered this, so needs more investigation, but Oracle's create schema authorization at least allows to bundle several DDL statements in a single transaction, thus avoiding several commits, and guarantees no side-effects, i.e. a rollback, if any one of the DDL statement fails.

It is unclear whether the rollback applies to the wrapped DDL statements only, as-if the create schema started a save-point, or the outer transaction with possibly some prior DML statement.

You still cannot avoid the commit after the last wrapped DDL statement complete successfully though.


No. In Oracle DDL statements themselves are not transactional.

Running a DDL statement will implicitly commit any open transaction for that session before starting the actual work.

In addition some statements, like an alter table statement, may fail if another session has an open transaction on the object being modified or one of its dependencies. You can set a ddl_lock_timeout to specify how long you want Oracle to wait for the object to become available.

See DDL Statements for a summary of types of DDL statements and information about their behaviour regarding locks and transactions.

Oracle Database implicitly commits the current transaction before and after every DDL statement.


DDL is not transactional in Oracle. From the 11.2 doc:

Oracle Database implicitly commits the current transaction before and after every DDL statement.