Procedures are performed without roles. One way to check if a command can be executed in a procedure is to execute:
SQL> set role none; Role set
You will have the same set of rights as your procedures:
SQL> SELECT * FROM dba_jobs_running; SELECT * FROM dba_jobs_running ORA-00942: table or view does not exist
You must provide the choice in the view directly to the user:
SQL> -- with dba account SQL> grant select on dba_jobs_running to a; Grant succeeded
Then you can compile the procedure:
SQL> -- with application schema SQL> CREATE OR REPLACE PROCEDURE test_dba AS 2 BEGIN 3 FOR cc IN (SELECT * FROM dba_jobs_running) LOOP 4 NULL; 5 END LOOP; 6 END test_dba; 7 / Procedure created
source share