Try running this code
====================
[code]
CREATE or REPLACE PROCEDURE SIDS
AS
CURSOR blocking_sid_cursor IS SELECT a.* FROM gv$lock a, gv$lock b WHERE (a.block <>0 AND b.request > 0 AND a.id1 = b.id1 AND a.id2 = b.id2);
blocking_rec blocking_sid_cursor%ROWTYPE;
BEGIN
OPEN blocking_sid_cursor;
LOOP
FETCH blocking_sid_cursor INTO blocking_rec;
EXIT WHEN blocking_sid_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('SID is : ' || blocking_rec.SID);
END LOOP;
CLOSE blocking_sid_cursor;
END SIDS;
[/code}
Hope that solves your problem.
Note :--You are not supposed to manipulate with this system table unless you are aware of possible danger or you are a DBA.
SQL> CREATE or REPLACE PROCEDURE SIDS
2 AS
3 blocking_rec blocking_sid_cursor%ROWTYPE;
4 CURSOR blocking_sid_cursor
5 IS
SELECT * FROM gv$lock a, gv$lock b
6 7 WHERE (a.block <>0 AND b.request > 0 AND a.id1 = b.id1 AND a.id2 = b.id2);
8 BEGIN
9 OPEN blocking_sid_cursor;
10 LOOP
11 FETCH blocking_sid_cursor INTO blocking_rec;
12 EXIT WHEN blocking_sid_cursor%NOTFOUND;
13 DBMS_OUTPUT.PUT_LINE('SID is : ' || blocking_rec.SID);
14 END LOOP;
15 CLOSE blocking_sid_cursor;
16 END SIDS;
17 /
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE SIDS:
LINE/COL ERROR
-------- -----------------------------------------------------------------
3/14 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
3/14 PL/SQL: Item ignored
11/1 PL/SQL: SQL Statement ignored
11/32 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
13/1 PL/SQL: Statement ignored
13/37 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
LINE/COL ERROR
-------- -----------------------------------------------------------------
SQL>
Its Not working . Pls help me