创建视图时的 Oracle 错误 - ORA-01720

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36551639/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 03:12:46  来源:igfitidea点击:

Oracle Error When Creating View - ORA-01720

sqloracleoracle11g

提问by David Zemina

I am having an issue in my Oracle 11.2.0.4.0 environment that has me stumped. I have a WORKING, COMPILED view in existence, which I can select data from, but I cannot alter it without getting an "ORA-01720" error.

我在我的 Oracle 11.2.0.4.0 环境中遇到了一个让我难堪的问题。我有一个 WORKING, COMPILED 视图,我可以从中选择数据,但我不能在没有收到“ORA-01720”错误的情况下更改它。

A bit about my setup: I have 2 schemas, "A" and "B" to be simple. Schema "A" owns "TABLE1", "TABLE2", "TABLE3" and schema "B" currently has the grants required to select data from all 3 tables. I have verified that I can select the data through a query, as well as the view that exists.

关于我的设置的一点:我有 2 个模式,“A”和“B”很简单。架构“A”拥有“TABLE1”、“TABLE2”、“TABLE3”,架构“B”目前拥有从所有 3 个表中选择数据所需的授权。我已经验证我可以通过查询选择数据,以及存在的视图。

Does anyone know what might be preventing me from altering a working view when my schema "B" has granted access to schema "A" data within those three tables? I saw several suggestions from google and various sites mentioning granting select "with grant option", which I have tried, but I do not see how it would apply when I am selecting data directly from the owner, not from a grantee. The error message is below:

当我的架构“B”已授予对这三个表中的架构“A”数据的访问权限时,有谁知道什么可能阻止我更改工作视图?我看到来自谷歌和各种网站的一些建议提到授予选择“带授予选项”,我已经尝试过,但是当我直接从所有者而不是从受赠者那里选择数据时,我不知道它会如何应用。错误消息如下:

SQL Error: ORA-01720: grant option does not exist for 'A.TABLE1'
01720. 00000 -  "grant option does not exist for '%s.%s'"
*Cause:    A grant was being performed on a view or a view was being replaced
           and the grant option was not present for an underlying object.
*Action:   Obtain the grant option on all underlying objects of the view or
           revoke existing grants on the view.

回答by Alexey

It is a limitation introduced in Oracle 11. You cannot add a table you do not own, but have been granted rights to, to an existing view even with create or replace force view. You have to drop the view first and the recreate it.

这是 Oracle 11 中引入的限制create or replace force view。即使使用. 您必须先删除视图并重新创建它。