Inserting Record Problem [message #164851] |
Mon, 27 March 2006 02:00 |
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 |
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 #165001 is a reply to message #164857] |
Tue, 28 March 2006 00:05 |
|
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
|
|
|