oracle 我需要授予访问权限以在另一个模式中使用一个模式的表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11399202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I need to grant access to use tables of one schema in another schema
提问by user1469630
I have an schema [A], which has a package in which a function calls another schema's[B] table [tableB]. When I compiled the package I got the error, "table or view doesnt exit" I googled and found that the error is because my package is calling another schema's table. Later I found that I have to grant privilage in the called schema[B]. In Schema B's package I wrote the following code
我有一个架构 [A],它有一个包,其中一个函数调用另一个架构的 [B] 表 [tableB]。当我编译包时出现错误,“表或视图不退出”我用谷歌搜索并发现错误是因为我的包正在调用另一个模式的表。后来我发现我必须在被调用的模式[B]中授予特权。在 Schema B 的包中,我编写了以下代码
procedure givePrivilege begin GRANT SELECT ON tableB TO A; end;
过程 givePrivilege 开始 GRANT SELECT ON tableB TO A; 结尾;
Im new to Oracle and Im struck.
我是 Oracle 的新手,我受到了打击。
采纳答案by Justin Cave
As B, you simply need to grant A SELECT
privileges on the table. You don't need to create a procedure that grants the privilege. You simply need to execute the GRANT
statement while logged in as B.
作为 B,您只需要授予 ASELECT
对表的权限。您不需要创建授予特权的过程。您只需要GRANT
在以 B 身份登录时执行该语句。
GRANT SELECT ON tableB
TO a
回答by Chandu
Follow these steps:
按着这些次序:
1) Login to schema B
2) Run the statement GRANT SELECT ON tableB TO A;
3) In the package make sure the tableB is referenced as B.tableB
4) Compile the package.
1) 登录模式 B
2) 运行语句GRANT SELECT ON tableB TO A;
3) 在包中确保 tableB 被引用为 B.tableB
4) 编译包。