oracle 查看锁表状况以及游标的使用

declare
       --类型定义
       cursor cust_info
       is
       select apply_id
       from apply_cust_info where id_num in ('445202198704287713');
       --定义一个游标变量cust_row cust_info%ROWTYPE ,该类型为游标cust_info中的一行数据类型
       cust_row cust_info%rowtype;
begin
       delete apply_cust_info where id_num in ('445202198704287713');
       for cust_row in cust_info loop
          delete from apply_cust_credit_info where apply_id = cust_row.apply_id;
       end loop;
end;


-----------------查询表是否被锁
SELECT object_name, machine, s.sid, s.serial# 
FROM gv$locked_object l, dba_objects o, gv$session s 
WHERE l.object_id = o.object_id 
AND l.session_id = s.sid;

你可能感兴趣的:(java)