ORA-01720: 无法授予视图权限

ORA-01720: Can't grant privileges on a view

我有一个用户拥有一些表,我将其中三个表的权限授予另一个用户。现在我需要创建一个视图并将 select 授予另一个用户,如下所示:

用户 A

GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE_A TO USER_B WITH GRANT OPTION;

GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE_B TO USER_B WITH GRANT OPTION;

GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE_C TO USER_B WITH GRANT OPTION;

用户 B

CREATE OR REPLACE VIEW V_XYZ AS SELECT * FROM TABLE_A, TABLE_B, TABLE_C;

GRANT ALL ON V_XYZ to USER_C;

这给出了以下错误:

ORA-01720: "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.

尝试给予:

GRANT select ON V_XYZ to USER_C;

您要求将所有权限授予 USER_C,但只有 4 个授予您对基础表的权限。尝试将所有权限从 A 授予 B,或者限制从 B 到 C 的授予 SELECT、UPDATE、INSERT、DELETE。