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: Locking Table

Re: Locking Table

From: Martin Hepworth <maxsec_at_usa.net>
Date: Tue, 25 May 1999 10:35:30 +0100
Message-ID: <374A6EE2.72A72737@usa.net>


hi_wean_at_my-dejanews.com wrote:
>
> Hi there,
>
> I've a table, tbl_runno as following:
>
> appln_type VARCHAR2(10)
> runno NUMBER(5)
>
> Here are the scenarios,
> 1. Open a Oracle session, logon as 'user1'
> 2. SELECT runno FROM tbl_runno; return as 5
> 3. UPDATE tbl_runno SET runno = runno + 1; should be = 6
> 4. Do not COMMIT till all the transactions are successfully executed.
> 5. At the same time (1 second later), another Oracle session, logon as
> 'user1' as well
> 6. SELECT runno FROM tbl_runno; return as 5 still.
>
> Questions:
> 1. How can the 2nd user get runno = 6, when the 1st user still has not
> issue the COMMIT statement?
> 2. Is it any LOCK available in Oracle 8.0.5?
>
> Can anyone help me on these? Thank ou very much!
>
> Best Regards
> HW
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---

HI
You might want to use a 'sequence' for this sort of thing, rather than relying on your own critical sections to handle this.

Martin Received on Tue May 25 1999 - 04:35:30 CDT

Original text of this message

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