请教:
1、存储过程执行完,是不是自动提交事务?
2、存储过程中的begin
insert into table1 select * from table2--commit; 不提交
exception
when others then
--如果遇到错误这里还要不要先rollback
insert into errlog values(sysdate,sqlcpde);
--这句要不要提交?好像后面不要commit,也自动保存进去了;
end 3、执行存储过程时,要不要在后面加入commit;begin
execute proc1;
commit; --?????必须马?
end;
谢谢!
1、存储过程执行完,是不是自动提交事务?
2、存储过程中的begin
insert into table1 select * from table2--commit; 不提交
exception
when others then
--如果遇到错误这里还要不要先rollback
insert into errlog values(sysdate,sqlcpde);
--这句要不要提交?好像后面不要commit,也自动保存进去了;
end 3、执行存储过程时,要不要在后面加入commit;begin
execute proc1;
commit; --?????必须马?
end;
谢谢!
2.出错的话最好先ROLLBACK,后面的insert 当然要commit的否则会话结束会被回退的。
3.不是必须,在一个session内提交掉就可以了。