简体   繁体   English

Oracle:表或视图不存在

[英]Oracle : Table or view doesn't exist

I am trying to create a view in Oracle using Toad and getting error table or view doesn't exist. 我正在尝试使用Toad在Oracle中创建视图,并且获取错误表或视图不存在。

But when I run the query on its own it executes successfully. 但是,当我自己运行查询时,它会成功执行。 What is the possible reason ? 可能的原因是什么?

CREATE OR REPLACE FORCE VIEW MGR.V_INDEX_PERFORMANCE
(
          INDEX_ID ,
          INDEX_NAME,
          MTD,
          YTD 
)
   BEQUEATH DEFINER
AS

SELECT    "INDEX_ID" ,
          "INDEX_NAME",
          "MTD",
          "YTD" from MIS_PERMAL.MV_INDEX_PERFORMANCE 
   where INDEX_ID in (1045, 2005) AND FIELD_CODE = 'TR' AND CCY_CODE IN ('D', 'USD') order by INDEX_ID, price_date desc;

It's permissions, or rather the way they are granted. 这是权限,或者更确切地说,是授予权限的方式。 The MGR user has a privilege to query the underlying table which comes from a role. MGR用户具有查询来自角色的基础表的特权。 Oracle does not allow us to build views or procedures using privileges from a role. Oracle不允许我们使用角色的特权来构建视图或过程。 This is just the way the security model works. 这就是安全模型的工作方式。

The solution is to ask the table owner MIS_PERMAL (or a power user such as a DBA) to grant the SELECT privilege on MV_INDEX_PERFORMAMCE directly to MGR. 解决方案是要求表所有者MIS_PERMAL(或高级用户,例如DBA)将MV_INDEX_PERFORMAMCE的SELECT特权直接授予MGR。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM