Home » Developer & Programmer » Forms » Fetching Data (10g, 6i forms, XP)
Fetching Data [message #474558] Tue, 07 September 2010 04:04 Go to next message
Mozart
Messages: 7
Registered: March 2009
Location: Dubai
Junior Member
Hello,

I have a detailed block with a user ID column. The user name is not available in the block. Therefore, I have created a non-database column to retrieve the user name into it.

Here is the code I've used.

PROCEDURE get_details IS

iLoop number := 1;

 CURSOR c is
	
       SELECT FULL_NAME
       FROM GRP_EMPLOYEE
       WHERE  EMPLOYEE_NUMBER = :USER_ID;

BEGIN
	
  OPEN c;
 	
LOOP
	
  message(iLoop);
	
    	FETCH c into :FULL_NAME;  
    	 	       
  message(:FULL_NAME); 
  
     	 iLoop := iLoop + 1;
           
		EXIT WHEN iLoop = 6;
			NEXT_RECORD;
  END LOOP;        
  
CLOSE c;

END;




However, it retrieves the first record only.

The results are displayed like this.


Loop:        Result:

1            Full_Name
2            Empty
3            Empty
4            Empty



Any help will be much appreciated thanks.

[Updated on: Tue, 07 September 2010 04:06]

Report message to a moderator

Re: Fetching Data [message #474559 is a reply to message #474558] Tue, 07 September 2010 04:11 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Scrap the procedure.
Put a select statement in the post-query trigger instead. This runs once for each record queried so no loops are needed.
Re: Fetching Data [message #474560 is a reply to message #474559] Tue, 07 September 2010 04:21 Go to previous message
Mozart
Messages: 7
Registered: March 2009
Location: Dubai
Junior Member

That worked ;D

Thanks.
Previous Topic: Migrating from oracle 8i to oracle 10g
Next Topic: Forms 10g
Goto Forum:
  


Current Time: Thu Sep 19 13:07:23 CDT 2024