Exclusivity SQL

 
create table blocks_all_other_changes_when (
  x integer
);

create procedure until_we as
begin
  null;
end;
/

begin
  lock table blocks_all_other_changes_when in exclusive mode;

  until_we;

  commit;
end;
/

lock table blocks_all_other_changes_when in exclusive mode;

pause
--execute any of the following in a separate session and you'll find them blocked...
--insert into blocks_all_other_changes_when values (1);
--delete from blocks_all_other_changes_when ;
--update blocks_all_other_changes_when set x = 2;

commit;
drop table blocks_all_other_changes_when purge;
drop procedure until_we ;

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)