kazasaritha
4th March 2004, 07:43
Hai,

I am getting one error while inserting data into a table. i.e. Duplicate value on index.
Here, One record is inserting successfully. Where as while trying to insert 2nd record it is
giving error.

Code follows:

function update.tdvel907()
{
db.retry.point()

select tdvel907.*
from tdvel907
|for update
where tdvel907._index1
={:unit,:mnth,:year,:tipcs020.cprj,:mitm.topl,:tipcs022.sitm,:tipcs022.opol,:sitm.cuni}

selectdo
selectempty
db.set.to.default(ttdvel907)
tdvel907.unit = unit
tdvel907.mnth = mnth
tdvel907.year = year
tdvel907.cprj = tipcs020.cprj
tdvel907.mitm = mitm.topl
tdvel907.sitm = tipcs022.sitm
tdvel907.icat = tipcs022.opol
tdvel907.cuni = sitm.cuni
tdvel907.qana = sitm.gqan
db.insert(ttdvel907,db.retry)
commit.transaction()

|message(" after commint %s %s %s %s %s %s %s",tipcs020.cprj, mitm.topl,tipcs022.sitm,tipcs022.opol,tivel905.mnth,tivel905.year,tivel905.unit)

endselect
}

History of this case:
I'm trying to insert monthly planned quantities which I enter in tdvel905 into tdvel907.
and I want to insert the output which comes from session tipcs2452m000 session....

Help me out.. as if this gives me solution for so many thing

suhas-mahajan
4th March 2004, 12:04
Hi,

Recently I came across similar kind of requirement, as our peoples want to store more info like RCIA no., qty etc. with invoice information and I successfully resolved it, please find attachment.

You should add "pono" field in index and update it with other records i.e. tipcs022.pono, as the database error message is self-explainatory here.

Hope this helps.

-Suhas