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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to Lock a column?

Re: How to Lock a column?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 05 Nov 1999 07:54:34 -0500
Message-ID: <KdMiOF4x9T7NEumCPolCD86r7QO3@4ax.com>


A copy of this was sent to wy_at_fudan.edu (if that email address didn't require changing) On Fri, 05 Nov 1999 10:22:42 GMT, you wrote:

>I have a table : T1
>Create Table T1
>(f1 char(10),
> f2 char(20),
> f3 char(20)
>);
>
>and I Want to lock the field f2.
>I use 'Select f2 from t1 for update of f2';
>
>In another connection.
>I use 'Select f1 from t1 for update of f1';
>
>and it lock!
>when I commit the first connection.
>it unlock;
>
>then how to lock the column f2 and not lock the column f1?
>

you don't lock colums, you lock rows. When you say "for update of column_name" in a for update statement, you do so to specify which table to lock rows in (it is used for a multi-table select, not very useful for a single table select).

There is no way to lock a 'column'. You would have to keep the columns in 2 separate tables and join them if you wanted to 'lock a column'.

>I use oracle 8.0.5 for linux.
>
>Any suggestions are helpful!
>
>Thanks in advance.
>
>
>YangWang.
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Nov 05 1999 - 06:54:34 CST

Original text of this message

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