Grant SELECT on multiple tables oracle

后端 未结 5 644
攒了一身酷
攒了一身酷 2020-12-11 00:37

I have 3 tables table1,table2,table3. I want to grant(select for example) these tables to a user, user1.

I know that I can grant with:

grant select          


        
5条回答
  •  不思量自难忘°
    2020-12-11 01:18

    This worked for me on my Oracle database:

    SELECT   'GRANT SELECT, insert, update, delete ON mySchema.' || TABLE_NAME || ' to myUser;'
    FROM     user_tables
    where table_name like 'myTblPrefix%'
    

    Then, copy the results, paste them into your editor, then run them like a script.

    You could also write a script and use "Execute Immediate" to run the generated SQL if you don't want the extra copy/paste steps.

提交回复
热议问题