Logo 
Search:

Oracle Articles

Submit Article
Home » Articles » Oracle » Common StatementsRSS Feeds

Create an SQL statement that will generate a series of GRANT statements to five new users

Posted By: Alexander Bouchard     Category: Oracle     Views: 1884

Using the SYS.DBA_USERS view (Personal Oracle7), create an SQL statement that will generate a series of GRANT statements to five new users: John, Kevin, Ryan, Ron, and Chris. Use the column called USERNAME. Grant them Select access to history_tbl.

SET ECHO OFF
SET FEEDBACK OFF
SPOOL GRANTS.SQL
SELECT 'GRANT SELECT ON HISTORY_TBL TO ' || USERNAME || ';'
FROM SYS.DBA_USERS
WHERE USERNAME IN ('JOHN','KEVIN','RYAN','RON','CHRIS')

grant select on history_tbl to JOHN;
grant select on history_tbl to KEVIN;
grant select on history_tbl to RYAN;
grant select on history_tbl to RON;
grant select on history_tbl to CHRIS;

  
Share: 



Alexander Bouchard
Alexander Bouchard author of Create an SQL statement that will generate a series of GRANT statements to five new users is from Montreal, Canada.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!