Write an Example for autonomous_transaction in Sql

Write an Example for autonomous_transaction in Sql
create table log (sf varchar2(10));
create table log1 (v number);
create or replace procedure ins_log (p_str varchar2)
AS
pragma autonomous_transaction;
BEGIN
Insert into log values (p_str);
commit;
end;
/

create or replace procedure main (p_val number)
AS
BEGIN
insert into log1 values (p_val);
if p_val>100 then
ins_log('success');
commit;
else
ins_log('fail');
rollback;
end if;
end;
/

No comments:

 
Top Blogs