CREATE OR REPLACE procedure BASEL2.who_lock_the_row_1
is
v_sid varchar2(200);
v_object_name varchar2(200);
v_roid varchar(200);
v_actnum varchar2(200);
v_sql varchar2(400);
begin
select do.object_name,
dbms_rowid.rowid_create ( 1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW# ) roid
into v_object_name,v_roid
from v$session s, dba_objects do
where sid=(select s2.sid
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 )
and s.ROW_WAIT_OBJ# = do.OBJECT_ID ;
v_sql:= 'select actnum from '||v_object_name ||' where rowid='||v_roid||';';
execute immediate v_sql;
dbms_output.put_line(v_actnum);
end;
Halim, a Georgia Tech graduate Senior Database Engineer/Data Architect based in Atlanta, USA, is an Oracle OCP DBA and Developer, Certified Cloud Architect Professional, and OCI Autonomous Database Specialist. With extensive expertise in database design, configuration, tuning, capacity planning, RAC, DG, scripting, Python, APEX, and PL/SQL, he combines technical mastery with a passion for innovation. Notably, Halim secured 16th place worldwide in PL/SQL Challenge Cup Playoff on the year 2010.
Monday, November 2, 2009
Subscribe to:
Post Comments (Atom)
My Blog List
-
-
-
ASSM states3 weeks ago
-
UKOUG Discover 20241 month ago
-
-
-
-
-
-
-
-
Moving Sideways8 years ago
-
-
Upcoming Events...11 years ago
-
No comments:
Post a Comment