Oracle: grant permissions to the whole schema

Technically saying, this is granting permissions to all tables in the schema


set verify off
set feedback off
set pagesize 10000
set linesize 120ACCEPT main_owner CHAR PROMPT 'MAIN OWNER: '
ACCEPT grant_to CHAR PROMPT 'GRANT TO: '
ACCEPT permissions CHAR PROMPT 'PERMISSIONS (i.e. SELECT,UPDATE): '

spool grant_from_&&main_owner._to_&&grant_to..sql

select 'grant &&permissions on "&&main_owner"."'
||table_name
||'" to "&&grant_to";' "---"
from dba_tables
where owner=upper('&&main_owner');

spool off

undefine permissions
undefine main_owner
undefine grant_to