Renaud Guérin wrote:
I think I need to lock the table against reads, not inserts. What I must ensure is that no more select's max(id)+1 can be done
before the
subsequent insert is completed. I don't know how to use LOCK to do that, anyone ?
You want LOCK TABLE table IN EXCLUSIVE MODE; most likely. A second lock statement will block until the first one clears.
damn, just read this: "A lock never prevents other users from querying the table. A query never places a lock on a table. Readers never block writers and writers never block readers. "
(http://download-west.oracle.com/otndoc/oracle9i/901_doc/server.901/a90125/st...)
So I guess that leaves me for good with only the sequence option, unless there's something we didn't think of...
thanks anyway!
But if you always issue a LOCK TABLE before SELECT MAX from... your LOCKs will compete against themselves, so you'll be safe. -- Matt Kromer Zope Corporation http://www.zope.com/