Home » SQL & PL/SQL » SQL & PL/SQL » Re:Assigning priviledge to all tables
Re:Assigning priviledge to all tables [message #629673] Sun, 14 December 2014 09:41 Go to next message
morrism35
Messages: 10
Registered: December 2014
Junior Member
Is it possible to grant alter and insert priviledges for all tables? My textbook says I have to
use seperate statements for each table. That is my first table here. I need two more. My assignment was too
add alter and insert privledges to my created role of "SuperInstr" which has already been created. There is my code below
for one table.
Thanks


grant alter, insert on tasks to SuperInstr;
Re:Assigning priviledge to all tables [message #629676 is a reply to message #629673] Sun, 14 December 2014 09:50 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
> My textbook says I have to use seperate statements for each table.

above is correct

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/

Re:Assigning priviledge to all tables [message #629677 is a reply to message #629676] Sun, 14 December 2014 09:52 Go to previous messageGo to next message
morrism35
Messages: 10
Registered: December 2014
Junior Member
Thank you I thought there might be another code supposed if the table has 100's of tables.
Re:Assigning priviledge to all tables [message #629679 is a reply to message #629677] Sun, 14 December 2014 09:57 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>if the table has 100's of tables.

above makes no sense.

you can write SQL to write SQL.


SQL> connect scott/tiger
Connected.

  1* select 'GRANT SELECT ON ' || table_name || ' TO HR;' from user_tables
SQL> /

'GRANTSELECTON'||TABLE_NAME||'TOHR;'
-----------------------------------------------------
GRANT SELECT ON DEPT TO HR;
GRANT SELECT ON EMP TO HR;
GRANT SELECT ON BONUS TO HR;
GRANT SELECT ON SALGRADE TO HR;
GRANT SELECT ON STAT_TABLE TO HR;
GRANT SELECT ON EMPLOYEES_LOG TO HR;
GRANT SELECT ON DATA_STAGING_REPOS TO HR;

7 rows selected.

SQL> 


Re:Assigning priviledge to all tables [message #629744 is a reply to message #629679] Mon, 15 December 2014 15:19 Go to previous messageGo to next message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
combine what BlackSwan showed you with the spool command
Re:Assigning priviledge to all tables [message #629788 is a reply to message #629744] Tue, 16 December 2014 03:03 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Or execute immediate if you just want to run it straight away and don't need a script file.
Previous Topic: dynamic sql column concat
Next Topic: Program never get completed
Goto Forum:
  


Current Time: Fri Apr 19 18:04:39 CDT 2024