Re: Oracle Lock

From: Frank <franjoe_at_frisurf.no>
Date: Wed, 7 Mar 2001 21:05:09 +0100
Message-ID: <qAwp6.9797$t21.260439_at_news3.oke.nextra.no>


    Hi!
Try
SELECT *
FROM table
WHERE ??????
FOR UPDATE;

....
...
...

UPDATE ........
....
WHERE id="id"
;

I'm not sure how to immitate the WITH (ROWLOCK) part in the update (I'm not sure how it works in MicrosoftSQL),
I dont think the second update will necessarily "stay within the" result set of the select above,
so your id="id" must do its job.

Frank

Roman Kirillov <rkirillov_at_equitel.com> wrote in message news:3AA68F35.E8CF18A9_at_equitel.com...
> Hello, my name is Roman Kirillov. I have some
> Oracle issue and I need help. Our company used Microsoft SQL before, but
> about 8
> months ago we switched to Oracle. Most of our code was transferred
> without any issues except this one. We used to do ROWLOCK in our SQL
> commands when writing ATL applications for accessing dbases, but with
> Oracle
> it does not seem to be working. Do you know of any good way to lock the
> row in Oracle after or during selection that no one else can modify it,
> then update it. I really need to have it in some of my C++ applications
> (not letting anyone touch my row until I do update). There is has to be
> a way to make it part of SQL command.
> I looked in documentation for Oracle, but did not find anything on row
> lock. Seems very strange because this issue is very important for any
> programmer.
>
> I give an example how we used to do this in Microsoft SQL, could you
> please help on this issue with Oracle.
>
> Example of Microsoft SQL row lock and update:
> SELECT mins.min_id, mins.min_num FROM mins WITH (ROWLOCK) WHERE
> (mins.status = 'F' OR mins.status = 'U') AND mins.lca_id = 'somenumber'
>
> UPDATE mins WITH (ROWLOCK) SET status = 'A' WHERE min_id = 'someminid
> from previous select'
>
> I would really appreciate any help. Thank you very much.
> Sincerely,
> Roman.
> --
> ********************************************
> * Roman Kirillov
> * Software Engineer
> * equitel, inc.
> * 4021 Stirrup Creek Drive, Suite 400
> * Durham, NC 27703
> * Phone: (919) 419-5600
> * Direct:(919) 419-7758
> * Fax: (919) 419-5601
> * mailto:rkirillov_at_equitel.com
> * http://www.equitel.com
> ********************************************
Received on Wed Mar 07 2001 - 21:05:09 CET

Original text of this message