TOraQuery: implicit rollback?
Posted: Thu 20 Mar 2014 11:23
Does ODAC perform some sort of implicit rollback whenever a PL/SQL block returns an error?
Start with an empty table.
Paste this code inside a TOraQuery, then ExecSQL() (AutoCommit is false)
select * returns 0 rows.
select * returns 1 row. This meas that internally Oracle does not rollback the procedure that raised the exception.
Now modify the last code like this
select * returns 0 rows. So, even if I deliberately ignore the first exception, when I raise the second one I automatically lose the data inserted by the first block.
Is there some way I can disable this "implicit rollback on exception" behaviour?
Start with an empty table.
Code: Select all
create table table1(a_name varchar2( 160 char ));
Code: Select all
begin
insert into table1 values('first record');
raise no_data_found;
end;
Code: Select all
declare
procedure do_insert
is
begin
insert into table1
values ( 'first record' );
raise no_data_found;
end;
begin
do_insert;
exception
when others then
null;
end;
Now modify the last code like this
Code: Select all
declare
procedure do_insert
is
begin
insert into table1
values ( 'first record' );
raise no_data_found;
end;
begin
begin
do_insert;
exception
when others then
null;
end;
insert into table1
values ( 'second record' );
raise no_data_found;
end;
Is there some way I can disable this "implicit rollback on exception" behaviour?