| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting GRANTs for actual user
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
![]() |
![]() |