怎样在查询记录时给记录加锁?

  • 系统环境:
      1、操作系统:Windows 2000
      2、数据库: Oracle 8i R2 (8.1.6) for NT 企业版
      3、安装路径:C:\ORACLE
  • 实现方法:
        
      利用SELECT的FOR UPDATE子句实现 conn system/manager --创建实验用户 grant connect,resource to test identified by test; conn test/test --创建实验表1 create table a(a number); insert into a values(1); commit; select * from a for update; 或 select * from a for update of a.a;(a表的a列) --新打开一个SQL*Plus窗口 conn test/test(test用户上的第二个会话) delete from a; 此时,系统停顿状态,等待解锁, 只要在第一个窗口发出roll;或commit;命令,即可解除锁定状态。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2021-09-11
  • 2022-02-09
  • 2021-12-18
猜你喜欢
  • 2021-11-14
  • 2021-11-29
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
相关资源
相似解决方案