Home » Developer & Programmer » Forms » Inserting Record Problem
Inserting Record Problem [message #164851] Mon, 27 March 2006 02:00 Go to next message
samit_gandhi
Messages: 226
Registered: July 2005
Location: Hong Kong
Senior Member

Dear David,

I am trying to insert the record from the multi record block into the database. The block does not have database property true. I want to insert the records which i will write in this block. The records are multiple so write the loop like this :

GO_BLOCK('INVOICE_DETAIL');
FIRST_RECORD;
LOOP
exit when :system.last_record='TRUE';
INSERT INTO AGEING_DETAIL
VALUES
(INVOICE_DETAIL.AC_CODE, :INVOICE_DETAIL.ANNEXURE_CODE, :INVOICE_DETAIL.COMPANY_ID, :INVOICE_DETAIL.INVOICE_NO,
:INVOICE_DETAIL.INVOICE_DATE, :PAYMENT_MASTER.VOUCHER_DATE, :INVOICE_DETAIL.AMT_RCD_HKD, :INVOICE_DETAIL.AMT_RCD_USD);
next_record;
END LOOP;

When the record saving done it is inserting one more record in the table. I dont know why this is happening.

pls help in this matter.

samit
Re: Inserting Record Problem [message #164856 is a reply to message #164851] Mon, 27 March 2006 02:38 Go to previous messageGo to next message
naveednt
Messages: 34
Registered: October 2005
Location: Karachi, Pakistan
Member
GO_BLOCK('INVOICE_DETAIL');
FIRST_RECORD;
LOOP
INSERT INTO AGEING_DETAIL
VALUES
(INVOICE_DETAIL.AC_CODE, :INVOICE_DETAIL.ANNEXURE_CODE, :INVOICE_DETAIL.COMPANY_ID, :INVOICE_DETAIL.INVOICE_NO,
:INVOICE_DETAIL.INVOICE_DATE, :PAYMENT_MASTER.VOUCHER_DATE, :INVOICE_DETAIL.AMT_RCD_HKD, :INVOICE_DETAIL.AMT_RCD_USD);
exit when :system.last_record='TRUE';
next_record;
END LOOP;



try this
Re: Inserting Record Problem [message #164857 is a reply to message #164851] Mon, 27 March 2006 02:38 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
One MORE record? I'd expect it to OMIT the last record in the block (as you exit the loop before the last record is being inserted into the table).
Re: Inserting Record Problem [message #165001 is a reply to message #164857] Tue, 28 March 2006 00:05 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
In which trigger do you have this code? Do you care if the data already exists in the database? Is it possible to run the code twice without clearing the block thereby causing a row to be actioned twice?

David
Previous Topic: How to run SQL Script from forms 6i?
Next Topic: .......... Dynamic Table selection
Goto Forum:
  


Current Time: Fri Sep 20 08:40:16 CDT 2024