Unix Technical Forum

Using public synonymes in stored procedures

This is a discussion on Using public synonymes in stored procedures within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi, I have a problem with one pubilc synonyme I using in a stored procedures. I try to find ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 11:19 AM
nicranet
 
Posts: n/a
Default Using public synonymes in stored procedures

Hi,

I have a problem with one pubilc synonyme I using in a stored
procedures. I try to find the role of SP-execute-user with:

SELECT granted_role INTO sRolle FROM DBA_ROLE_PRIVS where
grantee=(SELECT USER FROM DUAL);

But if I try to create the procedure with this statment, I get this
error :

LINE/COL ERROR
--------
-----------------------------------------------------------------
42/1 PL/SQL: SQL Statement ignored
42/38 PL/SQL: ORA-00942: Table or View does not exists

But DBA_ROLE_PRIVS is a public synonyme. It means everone can read
this table.
I don't understand, what do I wrong?

Can anybody help me? Thanks in advance!

P.S. Sorry for my bad english! :-)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 11:19 AM
Frank van Bortel
 
Posts: n/a
Default Re: Using public synonymes in stored procedures

On 16 feb, 15:53, "nicranet" <n...@freenet.de> wrote:
> Hi,
>
> I have a problem with one pubilc synonyme I using in a stored
> procedures. I try to find the role of SP-execute-user with:
>
> SELECT granted_role INTO sRolle FROM DBA_ROLE_PRIVS where
> grantee=(SELECT USER FROM DUAL);
>
> But if I try to create the procedure with this statment, I get this
> error :
>
> LINE/COL ERROR
> --------
> -----------------------------------------------------------------
> 42/1 PL/SQL: SQL Statement ignored
> 42/38 PL/SQL: ORA-00942: Table or View does not exists
>
> But DBA_ROLE_PRIVS is a public synonyme. It means everone can read
> this table.
> I don't understand, what do I wrong?
>
> Can anybody help me? Thanks in advance!
>
> P.S. Sorry for my bad english! :-)


Grant the owner of the procedure access to the tables/view.
PL/SQL is anonimous; it does not know of roles, so you
need direct (a.k.a object) access

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 11:19 AM
DA Morgan
 
Posts: n/a
Default Re: Using public synonymes in stored procedures

nicranet wrote:
> Hi,
>
> I have a problem with one pubilc synonyme I using in a stored
> procedures. I try to find the role of SP-execute-user with:
>
> SELECT granted_role INTO sRolle FROM DBA_ROLE_PRIVS where
> grantee=(SELECT USER FROM DUAL);
>
> But if I try to create the procedure with this statment, I get this
> error :
>
> LINE/COL ERROR
> --------
> -----------------------------------------------------------------
> 42/1 PL/SQL: SQL Statement ignored
> 42/38 PL/SQL: ORA-00942: Table or View does not exists
>
> But DBA_ROLE_PRIVS is a public synonyme. It means everone can read
> this table.
> I don't understand, what do I wrong?
>
> Can anybody help me? Thanks in advance!
>
> P.S. Sorry for my bad english! :-)


What Frank said and drop DUAL from your statement:

SELECT granted_role
INTO sRolle
FROM DBA_ROLE_PRIVS
WHERE grantee = USER;
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 11:19 AM
Frank van Bortel
 
Posts: n/a
Default Re: Using public synonymes in stored procedures

Frank van Bortel schreef:
> On 16 feb, 15:53, "nicranet" <n...@freenet.de> wrote:
>> Hi,
>>
>> I have a problem with one pubilc synonyme I using in a stored
>> procedures. I try to find the role of SP-execute-user with:
>>
>> SELECT granted_role INTO sRolle FROM DBA_ROLE_PRIVS where
>> grantee=(SELECT USER FROM DUAL);
>>
>> But if I try to create the procedure with this statment, I get this
>> error :
>>
>> LINE/COL ERROR
>> --------
>> -----------------------------------------------------------------
>> 42/1 PL/SQL: SQL Statement ignored
>> 42/38 PL/SQL: ORA-00942: Table or View does not exists
>>
>> But DBA_ROLE_PRIVS is a public synonyme. It means everone can read
>> this table.
>> I don't understand, what do I wrong?
>>
>> Can anybody help me? Thanks in advance!
>>
>> P.S. Sorry for my bad english! :-)

>
> Grant the owner of the procedure access to the tables/view.
> PL/SQL is anonimous; it does not know of roles, so you
> need direct (a.k.a object) access
>

Make that object grants - not access; obviously you need
access, but that will only happen if you're granted access


--
Regards,
Frank van Bortel

Top-posting is one way to shut me up...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 11:19 AM
Gerard H. Pille
 
Posts: n/a
Default Re: Using public synonymes in stored procedures

nicranet wrote:
> Hi,
>
> I have a problem with one pubilc synonyme I using in a stored
> procedures. I try to find the role of SP-execute-user with:
>
> SELECT granted_role INTO sRolle FROM DBA_ROLE_PRIVS where
> grantee=(SELECT USER FROM DUAL);
>
> But if I try to create the procedure with this statment, I get this
> error :
>
> LINE/COL ERROR
> --------
> -----------------------------------------------------------------
> 42/1 PL/SQL: SQL Statement ignored
> 42/38 PL/SQL: ORA-00942: Table or View does not exists
>
> But DBA_ROLE_PRIVS is a public synonyme. It means everone can read
> this table.
> I don't understand, what do I wrong?
>
> Can anybody help me? Thanks in advance!
>
> P.S. Sorry for my bad english! :-)
>


A public synonym does not allow public access, it does not provide any access rights.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 11:21 AM
nicranet
 
Posts: n/a
Default Re: Using public synonymes in stored procedures


thanks for your solution, but I can't grant the direct access rights
to the system tables. I solve this problem in other wise: i select the
role with a simple sql-statement: "SELECT granted_role FROM
DBA_ROLE_PRIVS where grantee=USER" and pass the reply as paramater to
the stored procedure.
It works. :-)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:22 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com