Hi,
I have a package that needs to assign a random, reusable number (ID) that is not currently being used - to a procedure.
I'm trying to simulate a pool of numbers (IDs) using a table that has an ID and IS_USED columns.
How do I do:
select a random ID (random row)
from pool_table
where IS_USED is 0 (not taken)
FOR UPDATE
The for update is to lock the row from being taken by another process calling the package.
OR:
Can I simulate a pool of numbers with a different object (not a table)?
I need the numbers to be coherent between sessions (thus package variables will not work) and only one session uses the same ID at any given time. When it finishes the number becomes available for further runs.
Thanks.
Edited by: Pyrocks on Nov 7, 2010 10:45 AM