Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Lock timeout on oracle 8i

Re: Lock timeout on oracle 8i

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Fri, 24 May 2002 18:49:14 +0200
Message-ID: <berseu054i1hvr79spg27rkgpgh4gnvo2h@4ax.com>


On 23 May 2002 21:10:05 -0700, rsusanto_at_atlas-sp.com (Rudy Susanto) wrote:

>Hi all,
>
>I want to convert my t-sql to pl/sql, especially related to lock
>timeout, do i apply with the correct programming on oracle?
>
>==> on sqlserver:
>declare @ename varchar(10)
>
>set lock_timeout 1500
>
>select @ename = ename
>from emp (rowlock,updlock)
>where empno=7900
>if @@error != 0 goto errhandler
>print 'ename: ' + @ename
>return
>
>errhandler:
>print 'Locking record(s) failed ...'
>return
>
>
>==> on oracle:
>declare
> i number(3,0);
> v_ename varchar2(10);
>
> busy exception;
> pragma exception_init(busy,-54);
>
>begin
> i := 1;
> loop
> begin
> select ename into v_ename
> from emp
> where empno=7900 for update nowait;
> dbms_output.put_line('ename: ' || v_ename);
>
> exception
> when busy then
> if i < 3 then
> dbms_lock.sleep(0.5);
> else
> dbms_output.put_line('Locking record(s) failed ...');
> exit;
> end if;
> end;
>
> i := i + 1;
> end loop;
>end;
>
>
>Thanks in advance,
>
>Rudy Susanto

There is no such thing as a lock time out in Oracle, as you don't need it, because readers don't block writers. I STRONGLY URGE YOU TO TRY TO *LEARN* ORACLE AND TO RETURN FROM YOUR WAY TO HELL, because if you plan to develop ALL YOUR CODE IN THE FASHION YOU DID ABOVE, YOUR SYSTEM IS GOING TO BE *DISASTROUS* BUY Expert One on One Oracle by Thomas Kyte READ IT AND PUT IT UNDER YOUR CUSHION AT NIGHT STOP THINKING Oracle IS SQLSERVER SOLD BY A DIFFERENT VENDOR. FORGET EVERYTHING YOU LEARNED UNTIL NOW. Probably the above manner is the ONLY WAY to make it CLEAR to sqlserver developers. The majority of them is so damn stubborn.

Regards

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Fri May 24 2002 - 11:49:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US