Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting GRANTs for actual user

Re: Getting GRANTs for actual user

From: Daniel Morgan <damorgan_at_exxesolutions.com>
Date: Tue, 09 Sep 2003 08:15:32 -0700
Message-ID: <1063120514.966375@yasure>


R. Heydenreich wrote:

>Hi all,
>
>I'm looking for a possibility to get the GRANTs for a user for a
>certain SEQUENCE. The first solution is as follows:
>
>SELECT 'GRANT ' || PRIVILEGE || ' ON ' ||
> (SELECT DISTINCT user_name
> FROM v$open_cursor
> WHERE sid in
> (SELECT s.sid
> FROM v$session s
> WHERE s.audsid = USERENV('SESSIONID')
> )
> ) || '.' || table_name || ' TO ' || grantee ||
> DECODE (grantable, 'YES', ' WITH GRANT OPTION', 'NO', '', '')
>GRANT_COMMAND
>FROM user_tab_privs
>WHERE table_name = 'sequence_name';
>
>This generates the following lines, f.i.:
>
>GRANT_COMMAND
>-----------------------------------------------------------------
>GRANT ALTER ON MYSCHEMANAME.SEQUENCE_NAME TO MYUSERNAME
>GRANT SELECT ON MYSCHEMANAME.SEQUENCE_NAME TO MYUSERNAME
>
>I think, this is not the optimal solution. How can I make this
>statement faster and easier?
>
>Greatings,
>Ralf.
>
>

If I understand your question ... what does it have to do with your SQL?

To find grants on a sequence ...

SELECT * FROM all_tab_privs_made;
and
SELECT * FROM all_tab_privs_recd;

I know sequences aren't tables .... but that doesn't stop Oracle from recording them in the same place.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Tue Sep 09 2003 - 10:15:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US