Home » Developer & Programmer » Forms » inserting multiple records in table through tabular form (oracle forms 10g)
inserting multiple records in table through tabular form [message #549554] Sun, 01 April 2012 07:25 Go to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
hi all

i have a master-detail form.
detail block is tabular.

when-button-pressed trigger iam inserting records
in another table.i write

insert into ONHAND_QTY_LOCATION(sno,matid,matcode,description,partno,onhand_qty,location)
values (:ship_dtl.slno,
:ship_dtl.mat_id,
:ship_dtl.mat_code,
:ship_dtl.description,
:ship_dtl.part_no,
:ship_dtl.rec_qty,
:ship_mstr.place_from)

it is inserting only one record in onhand_qty_location table that too the last record.

i want all the records which iam entering in detail block should get entered in onhand_qty_location table.

thanks in advance.
Re: inserting multiple records in table through tabular form [message #549557 is a reply to message #549554] Sun, 01 April 2012 08:28 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why are not using the default functionality?
Re: inserting multiple records in table through tabular form [message #549558 is a reply to message #549557] Sun, 01 April 2012 08:31 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
trying to enter the same data in 2 tables.

detail table using commit_form;

onhand_qty_location using INSERT statement
Re: inserting multiple records in table through tabular form [message #549559 is a reply to message #549558] Sun, 01 April 2012 08:32 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Then put the insert in pre-insert.
Re: inserting multiple records in table through tabular form [message #549561 is a reply to message #549554] Sun, 01 April 2012 08:49 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
very simple friend use pre-insert trigger on block level and on button trigger just commit. download this example fmb file

   declare
       A number := 1 ;
   begin
      first_record;
  loop
   A := A + 1 ;   	
      	INSERT INTO xyz
               (empno,ename)
   	VALUES(:empno,:ename);
  EXIT WHEN :system.last_record='TRUE';
   end loop ;
end ; 



baba Cool

[Updated on: Sun, 01 April 2012 08:50]

Report message to a moderator

Re: inserting multiple records in table through tabular form [message #549565 is a reply to message #549561] Sun, 01 April 2012 09:34 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
this one is better for which is acomplished on tabular field i have created for you download and run

   declare
      A number := 1 ;
   begin
      loop

      A := A + 1 ;   	
        INSERT INTO xyz(empno,ename)
    		VALUES(:empno,:ename);
     EXIT WHEN :emp.empno is not null ; 
       end loop ;
   end ; 



enjoy
baba Cool


Re: inserting multiple records in table through tabular form [message #549571 is a reply to message #549565] Sun, 01 April 2012 11:23 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why are coding loops in your examples?
All that's needed is the actual insert statement.
Re: inserting multiple records in table through tabular form [message #549574 is a reply to message #549571] Sun, 01 April 2012 13:23 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
Yes Mr @cookiemonster you r right without looping also we can do

pre-insert--->block-level

INSERT INTO xyz(empno,ename)
 	VALUES(:empno,:ename);

Re: inserting multiple records in table through tabular form [message #549576 is a reply to message #549565] Sun, 01 April 2012 13:37 Go to previous message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
I really thanks Mr.baba and all other.mr.baba it worked.
thank you all really a lot and also appreciate your interest
in guys like me with not much knowledge.but answers from expert like you guys really encourage us.
I tried to download pre_insert_tabular.fmb but was not successful.so i tried your post's coding.

thanx again.
Previous Topic: Difference between system.current_item and system.cursor_item
Next Topic: version conflict (merged 3)
Goto Forum:
  


Current Time: Fri Jul 05 23:38:22 CDT 2024