这段存储过程如何写?

chineseyounger 2003-08-22 09:11:01
有三个update连在一起!如果有一个update出现错误这其他的updata都不能执行!
如何做?谢谢!
...全文
37 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
deyi 2003-08-22
  • 打赏
  • 举报
回复
放在一个事物或回滚点中控制不就行了嘛。
要麻烦的就用管道或队列来做也可以的。
chinayk11 2003-08-22
  • 打赏
  • 举报
回复
begin
update a set a1='1111';
update b set b1='aaa';
exception when others then
rollback work;
end;
zjhclf 2003-08-22
  • 打赏
  • 举报
回复
begin
stoo_rowcnt:=0
update table 1 set sdfd=....;
stoo_rowcnt:=sql%rowcount;
exception
when others then
continue_flag:=false;
end;
if stoo_rowcnt=0 then
continue_flag:=false;
end if;
if continue_flag then
update table 2....
end if;
beckhambobo 2003-08-22
  • 打赏
  • 举报
回复
declare
v1 number;
v2 number;
v3 number;
begin
update ....;
v1:=sql%rowcount;
update....;
v2:=sql%rowcount;
update....;
v3:=sql%rowcount;
commit;
if v1=0 or v2=0 or v3=0 then
rollback;
end if;
end;
/

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧