Chang, Mei wrote:
> good point. I forgot to run commit via a sqlplus session. It works
> now.
>
> Can DBI generate an error string instead of hanging for a situation
> like
> this?

It's not an error condition to be waiting on other session's lock; and it
wouldn't be DBI's responsibility anyway, it's the underlying database.

If there's a _deadlock_, then Oracle does detect this and raise an error
within a couple of seconds. But you're not deadlocked in this situation,
just waiting.

If you want to be able to update the rows immediately, making sure you don't
have to wait for another session's locks to release, you can SELECT ... FOR
UPDATE NOWAIT the rows. This takes out locks on the rows, or errors if it
can't (can't remember the code offhand, the message is something vaguely
like 'resource locked and NOWAIT specified'). Then you update them all in a
subsequent statement, commit, and it releases the locks.

In 9i you can also specify a timeout for how long you want to wait for a
lock, rather the choices of 'immediate' or 'wait as long as it takes'.

But all this means you can only run once instance of your process at a time;
why don't you want to allow the database to queue up the updates?

-- 
Andy Hassall ([EMAIL PROTECTED]) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

Reply via email to