--在过程中可以用commit,在触发器中不允许用commit;但是在写过程的时候如果每写一个insert就有一个commit.那就提交了.如果其他的出错了就不能回滚了.所以为了保证事务的一致性, 一般是在最后commit;create or replace procedure proc_name as begin insert into .........; insert into ......... .... commit; <-- 一次提交 exception when others then rollback; <-- 出错全部回滚 end;
as
begin
insert into .........;
insert into .........
....
commit; <-- 一次提交
exception
when others then
rollback; <-- 出错全部回滚
end;
你的数据如果别人能看到说明提交了,如果你能看到,别人看不到说明没有提交,仍然在事务中,可能会被回滚,所有业务结束必须commit