Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Setting roles in stored procedure

647533Jun 30 2008 — edited May 26 2010
Hello,

Recently I've encountered a problem, when I try to set user ROLEs by encapsulating the 'set role' code in a stored procedure, I received an error message:

Error::: ORA-06565: cannot execute SET ROLE from within stored procedure.

I've tried some solutions given on the Internet:

1. dbms_session.set_role('rolenames') - the same error
2. dbms_utility.exec_ddl_statement('SET ROLE rolename');
3. encapsulation in an anonymus block:

begin
dbms_session.set_role('rolenames') - the same error
end;

All of the above haven't solved my problem.

Can any of You help me, mayby by providing sample code, or navigate me to some document. Mayby what I'm trying to do is impossible, however this is certainly not an option in my situation. Thank you in advance.

Krzysztof Kielan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 23 2010
Added on Jun 30 2008
12 comments
3,962 views