Caner.B
20th April 2002, 11:10
Hi,
I generated a session where I delete some records of table tfgld417.
when it will delete the second record it is giving this error " Error 206 (Record is not locked) on tfgld410xxx in db.delete (51)"
What is the meaning of this error?
The same script works fine with deleting records from tfgld410 but not with tfgld417.

Here is the script I use;

function delete.entegrations()
{ total = 0
db.retry.point()
select tfgld417.*
from tfgld417 for update
where tfgld417._index1 inrange {: ocom.f , tctror.prd , tcfitr.on.order
, :trdt.f , 0 , 0}
and {: ocom.t ,tctror.prd , tcfitr.from.project
, :trdt.t , 99999 , 99}
selectdo
select tfgld418.docn , tfgld418.sint
from tfgld418
where tfgld418._index1 inrange {:tfgld417.ocom , tctror.prd ,
:tfgld417.fitr , :tfgld417.trdt , :tfgld417.trtm , :tfgld417.sern , 0 }
and {:tfgld417.ocom , tctror.prd ,
:tfgld417.fitr , :tfgld417.trdt , :tfgld417.trtm , :tfgld417.sern , 999 }
selectdo
if tfgld418.sint = tfgld.sint.posted then
total = total + 1
mess(str$(total), 0 )
db.delete(ttfgld417 , db.retry)
commit.transaction()

else
rprt_send()
endif
endselect
endselect

Thanks

Caner

shah_bs
21st April 2002, 22:23
Based on the sample code that you have provided, the delete and commit should be done in following sequence:


db.retry.point()
select tfgld417.*
...
selectdo
select tfgld418.*
...
selectdo
...
endselect
...
db.delete(tfgld417, db.retry)
commit.transaction()
endselect


You must modify any related logic suitably.

[The reason you get the record not locked message is because the commit.transaction() releases the lock on the tfgld417 record, but there are still more tfgld418 records to process. So when the second tfgld418 record is being processed, the logic tries to delete the same tfgld417 record.]

Caner.B
23rd April 2002, 13:53
After changing the script like below. it works now fine.

Thank you very much. :)

db.retry.point()
select tfgld417.* for update , tfgld418
from tfgld417, tfgld418
...
selectdo
db.delete(tfgld417, db.retry)
commit.transaction()
endselect


Caner