JMac
03-11-2003, 12:41 PM
We have an application that needs to get n number of order items BUT(a) the first item number must be the lowest available
(b) the n number selected must all be sequential numbers.
so ... if I had a couple of million order items with item numbers 2300003 to 4504003, for example; and I needed 200 items, I'd like the first to be 2300003 and the last to be 2300203. However I don't want to (or I'd prefer not to) lock the entire table whilst I do this. There might be, in treality, several hundred thousand rows and many concurrent users.
Is locking FOR UPDATE the only real way of doing this? I suspect it is.
(b) the n number selected must all be sequential numbers.
so ... if I had a couple of million order items with item numbers 2300003 to 4504003, for example; and I needed 200 items, I'd like the first to be 2300003 and the last to be 2300203. However I don't want to (or I'd prefer not to) lock the entire table whilst I do this. There might be, in treality, several hundred thousand rows and many concurrent users.
Is locking FOR UPDATE the only real way of doing this? I suspect it is.