我需要授予对特定用户拥有的所有表的select权限给另一个用户。我可以用一个单一的命令,沿着以下行:
Grant Select on OwningUser.* to ReceivingUser
Select 'GRANT SELECT ON OwningUser.'||Table_Name||'TO ReceivingUser' From All_Tables Where Owner='OWNINGUSER'
嗯,它不是一个单一的语句,但它是尽可能接近你可以得到与oracle:
原文链接:https://www.f2er.com/oracle/207555.htmlBEGIN FOR R IN (SELECT owner,table_name FROM all_tables WHERE owner='TheOwner') LOOP EXECUTE IMMEDIATE 'grant select on '||R.owner||'.'||R.table_name||' to TheUser'; END LOOP; END;