本文通過一個(gè)具體的實(shí)例來解決Oracle數(shù)據(jù)庫如休在查詢記錄時(shí)給記錄加鎖呢? 系統(tǒng)環(huán)境 1、操作系統(tǒng):windows 2000 。 2、數(shù)據(jù)庫: Oracle 8i R2 (8.1.6) for NT 企業(yè)版。 3、安裝路徑:C:/Oracle。 實(shí)現(xiàn)方法 利用SELECT的FOR UPDATE子句實(shí)現(xiàn):
conn system/manager--創(chuàng)建實(shí)驗(yàn)用戶grant connect,resource to test identified by test;conn test/test--創(chuàng)建實(shí)驗(yàn)表1create 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列)--新打開一個(gè)SQL*Plus窗口conn test/test(test用戶上的第二個(gè)會(huì)話)delete from a;