User Hxl has DBA role,and it can access both of the two view(v$process p, v$session),but when i write a procedure which contain the two view and complie,it failed? Why?
SQL> show user;
USER is "HXL"
SQL> Select granted_role From DBA_ROLE_PRIVS a
2 Where a.grantee = 'HXL';
GRANTED_ROLE
------------------------------
CONNECT
OLAP_USER
CWM_USER
OWB_DESIGNCENTER_VIEW
OWB_USER
OWB$CLIENT
DBA
7 rows selected.
SQL> Select Count(1) From v$process Where Rownum=1;
COUNT(1)
----------
1
SQL> Select Count(1) From v$session Where Rownum=1;
COUNT(1)
----------
1
SQL> CREATE OR REPLACE Procedure sp_tt
2 Is
3 v_sid Number:=100;
4 Begin
5 SELECT p.SPID
6 into v_pid
7 FROM v$process p, v$session v
8
9 WHERE p.ADDR = v.PADDR
10 AND v.sid = v_sid;
11 End;
12 /
Warning: Procedure created with compilation errors.
SQL> show err;
Errors for PROCEDURE SP_TT:
LINE/COL ERROR
-------- -----------------------------------------------------------------
5/7 PL/SQL: SQL Statement ignored
7/14 PL/SQL: ORA-00942: table or view does not exist
SQL>