Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Insert with "nowait" - workaround.
Are you doing this through PL/SQL? If so, declare an exception variable that traps on ORA-00054:
record_locked EXCEPTION
PRAGMA EXCEPTION_INIT (record_locked, -54);
Now, in the exception statement of your block that's doing the insert (if your DML statement and related statements aren't in their own block, they should be!):
EXCEPTION
WHEN record_locked THEN /*output an error message, call another procedure, whatever*/ NULL;
In article <35446447.2E661096_at_ath.forthnet.gr>,
NIKOS OIKONOMOU <unixfor_at_ath.forthnet.gr> wrote:
>
> Please help us on the following problem
>
> Table A has two fields. Field pk is a primary key and field uk is a
> unique key.
> A session inserts into A the record (pk_val1, uk_val1) successfully.
> The session does not commit the insertion.
> Another session attempts to insert the same record
> and because there is the uncommitted previously inserted record from
> another session the second session has to wait until the first session
> execute a commit or a rollback releasing the row-lock.
>
> We want to change the above scenario. What we want is to make each
> session attempting to insert a record to be able to understand that at
> the specific moment a row-lock for the specific row exists and abort the
> insertion immediately.
>
> We may say that we need a 'NOWAIT' behavior for the insert operation.
>
> Which is the best method we can accomplish what we need? (We are looking
> for a work-around).
>
> Thank you very much.
> Nicolas Economou
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Mon Apr 27 1998 - 00:00:00 CDT
![]() |
![]() |