Home > database >  How to remove the cursor in the data
How to remove the cursor in the data

Time:09-21

In the process, the need to define A cursor in circulation, and then to judge if there is A record in the cursor in the loop, recorded execute A statement A, no record to another statement B,
But when the cursor is recorded in the statement in the loop always perform recorded after A, consult how to clear the data in the cursor,

 
The create or replace procedure proc_CHECK_CCB_RENT is
Str_location varchar2 (100);
Str_buildarea number;
Str_Mortgage number;
Str_Attachment number;
The begin
For release in (select CQZBH CQRXM, CQRZJHM, FWBH from SH_CONTRACT @ LINK_CCB_RENT t) loop
Declare
Cursor u_cur is
Select a location, build_area Isnot_Mortgage, Isnot_Attachment from V_ALL_REGINFO where r_name=the CQRXM
And ZJHM=release. CQRZJHM;
The begin
The open u_cur;
If u_cur % notfound then Rowcount u_cur % 0 always usage/* */
The update SH_CONTRACT @ LINK_CCB_RENT a set a.H YZT='failure' where a.F WBH=the FWBH;
The else
The fetch u_cur into str_location str_buildarea, str_Mortgage, str_Attachment;
The update SH_CONTRACT @ LINK_CCB_RENT a set a.H YZT='success', a.F WMJ=str_buildarea, a.F WZL=str_location, a.S FCZCF=to_char (str_Attachment), a.S=polyester FDY such to_char (str_Mortgage)
Where a.F WBH=release. FWBH;
end if;

The close u_cur;
end;
end loop;
commit;
End proc_CHECK_CCB_RENT;


CodePudding user response:

After u_cur % notfound to exit;
Or you will die cycle, has been update
  • Related