Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How do I lock Multiple Records?
Try this:
select * from mytable for update;
This will execute the select and hold the resulting records with an exclusive row lock.
On Mon, 22 Feb 1999 18:47:19 -0000, "Martin Speight" <martin_at_aspeight.freeserve.co.uk> wrote:
>Just select for update will do it :-
>
>SELECT *
>FROM TAB1
>WHERE ID=1 FOR UPDATE;
>
>INSERT ...
>
>COMMIT;
>
>John Francis Lundy wrote in message <36d18e78.0_at_news.proweb.co.uk>...
>>I need to be able to lock mulitple records the scenario is as follows:
>>
>>Records in table:
>>
>>ID Date StartTime EndTime
>>1 1/1/99 10:00 11:00
>>1 1/1/99 12:00 14:00
>>1 1/1/99 14:00 17:00
>>2 1/1/99 10:00 17:00
>>
>>
>>I need to add another record for ID 1 on 1/1/99, 07:00, 09:00
>>
>>I think I need to lock all records for ID 1 on 1/1/99
>>Check that the time does not overlap
>>create a new record if ok
>>then unlock all ID 1 records
>>How can I do this? Oracle 7.3
>>
>>Thanks for much needed help
>>
>>
>>
>
>
Received on Fri Feb 26 1999 - 15:06:30 CST