Wrap an Oracle schema update in a transaction -
i've got program periodically updates database schema. sometimes, 1 of ddl statements might fail , if does, want roll changes. wrap update in transaction so:
begin tran; create table (pkey int not null identity, newfieldkey int null, constraint pk_a primary key (pkey)); create index a_2 on (newfieldkey); create table b (pkey int not null identity, constraint pk_b primary key (pkey)); alter table add constraint fk_b_a foreign key (newfieldkey) references b (pkey); commit tran;
as we're executing, if 1 of statements fail, rollback instead of commit. works great on sql server, doesn't have desired effect on oracle. oracle seems implicit commit after each ddl statement:
- http://www.orafaq.com/wiki/sql_faq#what_are_the_difference_between_ddl.2c_dml_and_dcl_commands.3f
- http://infolab.stanford.edu/~ullman/fcdb/oracle/or-nonstandard.html#transactions
is there any way turn off implicit commit?
you can not turn off. easy work around designing scripts drop tables in event exist etc...
you can @ using flashback database, believe can @ schema/object level check docs confirm that. need on 10g work.
Comments
Post a Comment