?
Solved

Stored procedures error PLS-00201

Posted on 2003-02-21
3
Medium Priority
?
3,339 Views
Last Modified: 2013-12-12

(p_username IN dba_role_privs.grantee%TYPE,
p_role OUT dba_role_privs.granted_role%TYPE) IS
v_username dba_role_privs.grantee%TYPE;
v_role dba_role_privs.granted_role%TYPE;
BEGIN
SELECT granted_role INTO v_role
FROM dba_role_privs
WHERE grantee = p_username
AND granted_role NOT LIKE 'CON%';
p_role:=v_role;
END;

This code will not compile I get error:

LINE/COL ERROR
--------------------------------------------------------------------------------
2/15     PLS-00201: identifier 'DBA_ROLE_PRIVS' must be declared                
0/0      PL/SQL: Compilation unit analysis terminated                          


Any ideas?


Thanks
0
Comment
Question by:auvillem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Daniel Stanley earned 400 total points
ID: 7995320
Privileges granted via role are disabled inside stored procedures.  grant explicitly instead of from a role like dba.

example:
grant select on dba_role_privs to %USERNAME%;

good luck,
daniels@asix.com
0
 
LVL 7

Expert Comment

by:Daniel Stanley
ID: 7995351
here is a more detailed example:


$system$ORCL@scatcat>conn ascend/ascend
connected.
$ascend$ORCL@scatcat>create or replace procedure test(p_username IN dba_role_privs.grantee%TYPE,
  2  p_role OUT dba_role_privs.granted_role%TYPE) IS
  3  v_username dba_role_privs.grantee%TYPE;
  4  v_role dba_role_privs.granted_role%TYPE;
  5  BEGIN
  6  SELECT granted_role INTO v_role
  7  FROM dba_role_privs
  8  WHERE grantee = p_username
  9  AND granted_role NOT LIKE 'CON%';
 10  p_role:=v_role;
 11  END;
 12  /

Warning: Procedure created with compilation errors.

$ascend$ORCL@scatcat>show err
Errors for PROCEDURE TEST:

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      PL/SQL: Compilation unit analysis terminated
1/30     PLS-00201: identifier 'DBA_ROLE_PRIVS' must be declared


$ascend$ORCL@scatcat>conn system/manager
connectd.

$system$ORCL@scatcat>revoke dba from ascend;

Revoke succeeded.

$system$ORCL@scatcat>grant select on dba_role_privs to ascend;

Grant succeeded.

$system$ORCL@scatcat>conn ascend/ascend
Connected.
$ascend$ORCL@scatcat>create or replace procedure test(p_username IN dba_role_privs.grantee%TYPE,
  2  p_role OUT dba_role_privs.granted_role%TYPE) IS
  3  v_username dba_role_privs.grantee%TYPE;
  4  v_role dba_role_privs.granted_role%TYPE;
  5  BEGIN
  6  SELECT granted_role INTO v_role
  7  FROM dba_role_privs
  8  WHERE grantee = p_username
  9  AND granted_role NOT LIKE 'CON%';
 10  p_role:=v_role;
 11  END;
 12  /

Procedure created.

$ascend$ORCL@scatcat>show err
No errors.
$ascend$ORCL@scatcat>



good luck,
daniels@asix.com
0
 

Expert Comment

by:bgopalreddy
ID: 7995408
Please check your privileges. I think you don't have privileges(i.e DBA privilege or SELECT_ANY_TABLE privilege)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question