debugMinor
If an 'after' DDL trigger causes an error, is the DDL rolled back?
Viewed 0 times
afterrollederrortriggertheddlbackcauses
Problem
It has been suggested that DDL is logically performed something like this:
Which would suggest that any error in a trigger would cause the DDL to be rolled back. Is this the case?
begin
COMMIT;
perform any appropriate pre-DDL trigger code;
do the ddl;
perform any appropriate post-DDL trigger code;
COMMIT;
exception
when others then
ROLLBACK;
raise;
end;Which would suggest that any error in a trigger would cause the DDL to be rolled back. Is this the case?
Solution
The answer, at least on 11.2, is "It depends":
This
This
create is rolled back:create trigger trig_foo after create on schema
begin
raise_application_error(-20001, 'Dont do it!');
end;
/
--
create table foo as select level as id from dual connect by level
But this truncate is not:
create table foo as select level as id from dual connect by levelContext
StackExchange Database Administrators Q#9700, answer score: 9
Revisions (0)
No revisions yet.