When a DDL command is executed it is wrapped in commit's
eg:
begin
commit;
DDL command;
commit;
exception
when others then rollback;
end;
So even if the command fails a commit is still issued.
Worked example:
SQL> create table timtest(test number);
Table created.
SQL> insert into timtest values(1);
1 row created.
--But i never commit
SQL> create table timtest2 as select * from dba_objects;
create table timtest2 as select * from dba_objects
*ERROR at line 1:ORA-01013: user requested cancel of current operation
-- The DDL statement fails
SQL> rollback;
Rollback complete.
-- I rollback hoping to rollback the insert statement
SQL> select * from timtest;
TEST
----------
1
1 row selected.
-- but because the DDL statement committed first,
-- the insert statement committed.
***************************
keyword DDL commit rollback
***************************
No comments:
Post a Comment