Hi guys I have a pl/sql statement which is supposed to fetch data from one table to another through a cursor but some fields are empty and am thinking that is why it is exiting the line
exit when cursor%not found;
I have googled around and I have seen the suggestion to use the line after fetch statement but that seems to be the case when You have two cursors but in Mycase I have one cursor. Please some one help me tune up this query
CREATE OR REPLACE procedure TBAADM.MIGR_EIT
AS
CURSOR cur_eit IS SELECT entity_id, nrml_accrued_amount_cr,nrml_accrued_amount_dr, nrml_booked_amount_cr, nrml_booked_amount_dr, nrml_interest_amount_cr,
nrml_interest_amount_dr,
next_int_run_date_cr ,next_int_run_date_dr ,interest_calc_upto_date_cr, interest_calc_upto_date_dr,xfer_min_bal
,xfer_min_bal_date, booked_upto_date_cr,booked_upto_date_dr FROM TBAADM.eit_temp ;
tempeit1 TBAADM.EIT%ROWTYPE;
number_of_rows_updated number;
BEGIN
number_of_rows_updated:=0;
update tbaadm.eit_temp set entity_id=(select gam.acid from tbaadm.gam where gam.foracid=eit_temp.act_num);
OPEN cur_eit;
LOOP
FETCH cur_eit INTO tempeit1.entity_id,tempeit1.nrml_accrued_amount_cr,tempeit1.nrml_accrued_amount_dr,tempeit1 .nrml_booked_amount_cr,tempeit1.nrml_booked_amount_dr,
tempeit1.nrml_interest_amount_cr, tempeit1.nrml_interest_amount_dr,
tempeit1.next_int_run_date_cr ,tempeit1.next_int_run_date_dr ,tempeit1.interest_calc_upto_date_cr, tempeit1.interest_calc_upto_date_dr,tempeit1.xfer_min_bal
,tempeit1.xfer_min_bal_date, tempeit1.booked_upto_date_cr,tempeit1.booked_upto_date_dr;
exit when cur_eit%notfound;
Explicit cursors are not required (and IMHO advisible) anymore since Oracle 8. I’d rewrite your code to use an implicit cursor in a
FOR ... LOOP: