[Oracle]Oracle外部程序的触发小结
作者:unknown 来源:IT 专家网 添加时间:2006-5-26 9:53:23在论坛里曾经看过一个帖子,有位用户问了这么一个问题:oracle 里一个表插入一条数据,提交后,如何让外部程序收到这个消息?
当时没有留意,现在想想好像应该可以总结一下了。举例:
1、过程中:
...
declare
myexcept exception;
inserted_count1 number;
inserted_count2 number;
...
begin
insert into table values(...);
inserted_count1 := sql%rowcount;
... --可以判断inserted_count1是否大于0来确定是否插入了数据
commit;
inserted_count2 := sql%rowcount; --这里inserted_count2为0
... --事实上,这里一定是提交成功才会执行,否则会跳到exception段
yourprocess(yourpara);--调用你自己的过程或语句跟别的过程通信
...
exception
when others then ---你可以根据sqlcode自己去查具体的提交失败原因
...
yourprocess_for_fail(yourpara) --调用你自己的过程跟别的过程通信
...
end;
第 1 页,共 2 页 [1] [2]
站内搜索