Home » Developer & Programmer » Forms » loop insert empty row ??
loop insert empty row ?? [message #463790] Sat, 03 July 2010 09:19 Go to next message
ahmed_samir
Messages: 61
Registered: January 2009
Location: EGYPT
Member
hi there this is my insert loop but the problem is there is row added more than the normal count ..

DECLARE
   var_record_count   NUMBER;
   var_p_request      NUMBER;
   var_items_count    NUMBER;
BEGIN
   var_record_count := GET_BLOCK_PROPERTY ('control', current_record); -- supplier
  
   var_items_count := GET_BLOCK_PROPERTY ('PURCH_ITEMS_PRICE', current_record); -- items in 
   
   
   
--go_block('PURCH_PRICE_REQUEST'); 5463194 512 tedata + nada
--first_record;

   --GO_BLOCK ('PURCH_ITEMS_PRICE');
   --FIRST_RECORD;
----------------------------------- loop in side loop ------------------------------------

   ---- note am delet the relation ( . _ . ) *********************************************
   GO_BLOCK ('control');
   FIRST_RECORD;

-- loop depend on the supplier count
   FOR supp_loop IN 1 .. var_record_count
   LOOP
        SELECT seq_fahs_id.NEXTVAL
        INTO :GLOBAL.var_p_request
        FROM DUAL;
        
        
		   INSERT INTO PURCH_PRICE_REQUEST (
		   P_REQUEST_ID, P_REQUEST_DATE, P_REQUEST_SIGN_PURCH, SUPP_ID) 
			 VALUES (:GLOBAL.var_p_request ,null ,null ,:control.TXT_SUPP );
			 
		--	 commit_form;
			 
--------------- loop depend on the items in the for the supplier
					 		
					 			GO_BLOCK ('PURCH_ITEMS_PRICE');
		  					FIRST_RECORD;
		  					
					 		for item_loop in 1 .. var_items_count
					 		loop
					 					  					
		  					INSERT INTO PURCH_ITEMS_PRICE (
		   					ITEM_ID, P_REQUEST_ID, ITEM_PRICE, NOTES) 
								VALUES ( :item_id,:GLOBAL.var_p_request ,null ,null );
								
							--	commit_form;
								
								NEXT_RECORD;
								
					 		end loop;
					 		
					GO_BLOCK ('control');

					NEXT_RECORD;
 
      
					 	END LOOP;
					 	
					 	commit_form;
   END;


thanks
Re: loop insert empty row ?? [message #465207 is a reply to message #463790] Tue, 13 July 2010 03:46 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you solved your problem?

Why are you doing your own inserts? Just let Oracle Forms do its thing and everything will work. Less code and less errors.

David
Re: loop insert empty row ?? [message #465223 is a reply to message #465207] Tue, 13 July 2010 04:07 Go to previous messageGo to next message
ahmed_samir
Messages: 61
Registered: January 2009
Location: EGYPT
Member
yes that's right but when i try this .. more error happen to me .. coz there is relation between the two block must be deleted to work depend on the oracle inserting but if i use the insert statement it's the data worked well ..

sorry 4 my English language but hope to understand what i want to say ..

thanks
Re: loop insert empty row ?? [message #465453 is a reply to message #465223] Wed, 14 July 2010 03:50 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Instead of always doing 'NEXT_RECORD', have an 'IF' test for ":System.last_record != 'TRUE'" before doing the 'NEXT_RECORD'.

David
Re: loop insert empty row ?? [message #465460 is a reply to message #465453] Wed, 14 July 2010 04:42 Go to previous message
ahmed_samir
Messages: 61
Registered: January 2009
Location: EGYPT
Member
Thanks .. djmartin

that's right ..
Previous Topic: FRM-18103:Failed to initialize the Development Environment
Next Topic: close form or erp auto
Goto Forum:
  


Current Time: Fri Sep 20 06:24:31 CDT 2024