smusba
8th October 2011, 10:36
I want to update a record which meets the following criteria.
a) The no. of records should be greater than one only.
mark_h
9th October 2011, 05:05
Easy and I like to keep things simple.
select count(a.field):numrecs
from table a
where a._index1 = {:some.var}
selectdo
if numrecs >1 then
db.retry.point()
select table.fields
from table for update
where table._index1 = {:some.var}
selectdo
table.field = x
db.update(table,db.retry)
endselect
commit.transaction()
endselect
All you have to worry about are the where clauses, but something simple like this should work.
smusba
9th October 2011, 09:30
Dear Mark,
Thanks for your reply.
MilindV
16th October 2011, 16:40
To improve the performance you need to use "as set with 1 rows" in the out query which you are using for counting the records. Yes, you can use as set with one rows with aggregate functions (max, min, count). This will increase performance.