A SELECT FOR UPDATE statement obtains a TX lock and implicitly begins a transaction. COMMIT and ROLLBACK explicitly end the current transaction, so the first subsequent DML statement begins another one. DDL statements have implicit commit boundaries; after a CREATE TABLE completes successfully, a following CREATE INDEX executes as a new single-statement DDL transaction. A failed DML statement ordinarily rolls back only that statement rather than ending the existing transaction.
Community Discussion