Home » Developer & Programmer » Forms » cursor in the form (9i)
cursor in the form [message #363370] Sat, 06 December 2008 05:10 Go to next message
laith
Messages: 41
Registered: December 2008
Location: U.A.E
Member
i have form using 2 non database block and i want just to use the cursor to show data, and this is the cursor that i use:
PROCEDURE SHOW_ROWS IS
BEGIN
 DECLARE
      CURSOR PTI_CURSOR IS 
      SELECT PYPRCSD_ZONE_CODE , pubmast_type  , COUNT(*)
      from   PYPRCSD, pubmast x
      where  PYPRCSD_ACADEMIC_YEAR  = :acy_year
      and    PYPRCSD_ACTIVE_IND     = 'Y'
      AND    PYPRCSD_sticker_no IS NOT NULL

      and pubmast_pidm   = pyprcsd_pidm
      and pubmast_seq_no = pyprcsd_bene_seq_no
      and nvl(pubmast_sys_update_date,'01-jan-1900') = (select max(nvl(pubmast_sys_update_date,'01-jan-1900'))
                                                           from   pubmast
                                                           where  pubmast_pidm   = x.pubmast_pidm
                                                           and    pubmast_seq_no = x.pubmast_seq_no)

      and PYPRCSD_ZONE_CODE != 'EXPIRED'

      and trunc(PYPRCSD_RENEWAL_DATE) >= (:renewal_date)

      group by PYPRCSD_ZONE_CODE,pubmast_type
      order by PYPRCSD_ZONE_CODE,pubmast_type;
 
 BEGIN
      OPEN  PTI_CURSOR ;
    	loop
     		 FETCH PTI_CURSOR INTO :PYPRCSD_ZONE_CODE , :ZONE_TYPE, :ZONE_COUNT;
     		 next_record;
    	exit when PTI_CURSOR%notfound;
    	end loop;
    	close PTI_CURSOR;
    	
END;

END;

the problem is the pointer going to the last row (after last record ) and give me error message :

FRM-40102: Record must be entered or deleted first , so please can you tell me how can i solve this problem. thank you

[EDITED by LF: applied [code] tags]

[Updated on: Sat, 06 December 2008 10:22] by Moderator

Report message to a moderator

Re: cursor in the form [message #363387 is a reply to message #363370] Sat, 06 December 2008 10:24 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps you could change position of two lines in the FOR loop, so that you wouldn't go to a new record if it doesn't exist: instead of
next_record;
exit when PTI_CURSOR%notfound;
try with
exit when PTI_CURSOR%notfound;
next_record;

Re: cursor in the form [message #365259 is a reply to message #363370] Thu, 11 December 2008 04:23 Go to previous message
laith
Messages: 41
Registered: December 2008
Location: U.A.E
Member
thank you so much ...the problem is solved.
Previous Topic: where can i download sql loader
Next Topic: How to open a html page in forms..using web.show_document
Goto Forum:
  


Current Time: Fri Dec 09 17:24:26 CST 2016

Total time taken to generate the page: 0.34866 seconds