Subject Re: [firebird-support] concurrent inserts issue
Author Hans
Maybe use a generator instead of count(*)+1
-
Like gen-I'd


Sent by iPhone


On 2012-07-10, at 6:51 PM, "firebirdsql" <firebirdsql@...> wrote:

When I run the below query as a stored procedure asynchronously 1000 times, it results in duplicate numbers:
select count(id) from test_table into :number;
insert into test_table(number) VALUES(:number+1);

How do I solve this? I tried the WITH LOCK option but it doesn't work inside a stored procedure.



------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links