Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: grant select on SCOTT.* to vewalluser
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; /
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Allen, Brandon
Sent: Tuesday, October 31, 2006 1:13 PM
To: Roger.Xu_at_dp7upbg.com; Oracle-L_at_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.
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Oct 31 2006 - 12:17:11 CST
![]() |
![]() |