--查询锁表用户:一个用户不小锁住了表,其他用户查询是处于等待状态,这条语句可以查询那个用户锁住了那个表
select distinct b.sid, b.serial#,
a.object_id,d.object_name,
b.machine,
b.osuser,
a.PROCESS,
a.LOCKED_MODE,
b.username,
b.status,
b.schemaname,
b.terminal program ,
b.action ,
b.sql_address,
b.lockwait,
c.SQL_TEXT
from v$locked_object a,
v$session b,
v$sql c,
dba_objects d
where a.SESSION_ID = b.SID
and b.SQL_ADDRESS = c.address(+)
and d.object_id = a.OBJECT_ID
--定义一个表格类型
TYPE CRIS_EXP_BATCH_TYPE IS TABLE OF 表名称%ROWTYPE INDEX BY BINARY_INTEGER;
CRIS_EXP_BATCH_LIST CRIS_EXP_BATCH_TYPE;可以当list用,可以循环
FOR i IN CRIS_EXP_BATCH_LIST.FIRST .. CRIS_EXP_BATCH_LIST.LAST LOOP 循环。使用 CRIS_EXP_BATCH_LIST(i).CRIS_BATCH_NO。