在程序中 ,需要在回圈里 定義游標 , 然后在回圈里 判斷游標里是否有記錄,有記錄執行一條陳述句A,無記錄執行另外一條陳述句B。
但是當游標里有記錄后 在回圈里 始終執行有記錄的 陳述句A, 請教如何清空游標里的資料。
create or replace procedure proc_CHECK_CCB_RENT is
str_location varchar2(100);
str_buildarea number;
str_Mortgage number;
str_Attachment number;
begin
for release in (select cqzbh,cqrxm,cqrzjhm,fwbh from SH_CONTRACT@LINK_CCB_RENT t) loop
Declare
cursor u_cur is
select location,build_area,Isnot_Mortgage,Isnot_Attachment from V_ALL_REGINFO where r_name = release.cqrxm
and zjhm=release.cqrzjhm;
begin
open u_cur;
if u_cur%notfound then /* 使用 u_cur%Rowcount 始終為0 */
update SH_CONTRACT@LINK_CCB_RENT a set a.HYZT='失敗' where a.FWBH=release.fwbh;
else
fetch u_cur into str_location,str_buildarea,str_Mortgage,str_Attachment;
update SH_CONTRACT@LINK_CCB_RENT a set a.HYZT='成功',a.FWMJ=str_buildarea,a.FWZL=str_location,a.SFCZCF=to_char(str_Attachment), a.SFDY=to_char(str_Mortgage)
where a.FWBH=release.fwbh;
end if;
close u_cur;
end;
end loop;
commit;
end proc_CHECK_CCB_RENT;
uj5u.com熱心網友回復:
u_cur%notfound 之后要exit;否則會死回圈,一直update
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/62114.html
標籤:基礎和管理
上一篇:關于oracle 匯入匯出
下一篇:財務費用-匯兌損益,舍入賬戶
