RE: grant select on SCOTT.* to vewalluser

  • From: "Mercadante, Thomas F \(LABOR\)" <Thomas.Mercadante@xxxxxxxxxxxxxxxxx>
  • To: <Brandon.Allen@xxxxxxxxxxx>, <Roger.Xu@xxxxxxxxxxx>, "Oracle-L@Freelists. Org \(E-mail\)" <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 31 Oct 2006 13:17:11 -0500

I like to do this without spooling a file and needing to run that:

 

Declare 

 

CURSOR c3 IS

  SELECT 'GRANT SELECT ON ' || object_name || ' to viewallusers;'
out_line

  FROM USER_OBJECTS

  WHERE object_type = 'TABLE'

;

 

BEGIN

 

FOR c3_rec IN c3 LOOP

   EXECUTE IMMEDIATE RTRIM(c3_rec.out_line,';');

END LOOP;

 

END;

/

 

 


--------------------------------------------------------
This transmission may contain confidential, proprietary, or privileged 
information which is intended solely for use by the individual or entity to 
whom it is addressed.  If you are not the intended recipient, you are hereby 
notified that any disclosure, dissemination, copying or distribution of this 
transmission or its attachments is strictly prohibited.  In addition, 
unauthorized access to this transmission may violate federal or State law, 
including the Electronic Communications Privacy Act of 1985.  If you have 
received this transmission in error, please notify the sender immediately by 
return e-mail and delete the transmission and its attachments.


________________________________


From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Allen, Brandon
Sent: Tuesday, October 31, 2006 1:13 PM
To: Roger.Xu@xxxxxxxxxxx; Oracle-L@Freelists. Org (E-mail)
Subject: RE: grant select on SCOTT.* to vewalluser

 

Just a small syntax correction - you need the string concatenation
operator in there, and will probably want to add a semi-colon at the end
too:

 

select 'grant select on ' || table_name || ' to viewalluser;' from
user_tables;

 

Regards,

Brandon

Privileged/Confidential Information may be contained in this message or
attachments hereto. Please advise immediately if you or your employer do
not consent to Internet email for messages of this kind. Opinions,
conclusions and other information in this message that do not relate to
the official business of this company shall be understood as neither
given nor endorsed by it.

Other related posts: