Re: oracle concurrent

From: Robert C. Nix <rnix_at_us.oracle.com>
Date: 1996/01/31
Message-ID: <310FAE65.1232_at_us.oracle.com>#1/1


lee wrote:
>
> lee (lee_at_cnct.com) wrote:
> problem:
> how to avoid two user SELECT same data from database,
> and one's UPDATE + COMMIT overwrite another one's UPDATE +
> COMMIT ?
> we don't want lock the row after SELECT, but want lock
> the row after UPDATE, and before COMMIT, how to do
> this ?
> Thank you.

one option is to add a date_modified column to the table.

then do something like the foolowing:

select the_table.*
  into table_record
  from the_table
   ...;

...

update the_table

   set ...
 where date_modified = table_record.data_modified    ...;

if sql%notfound then

  • the record has already been modified
  • do something about it. end if;
--
-- can also create this trigger to ensure that the column is modified.
--
create or replace trigger the_trigger
   before insert or update
   on the_table
   for each row
begin
   :new.data_modified := sysdate;
end;


-- 
_________________________________________________
Robert C. Nix
Oracle Tools Support
rnix_at_us.oracle.com

The thoughts, opinions, remarks, suggestions, ...
expressed herein are my own and in no way should
be taken as a statement from Oracle Corporation.
Received on Wed Jan 31 1996 - 00:00:00 CET

Original text of this message