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.
