PL/SQL:ORA-00942:表或视图不存在V $ SQL [英] PL/SQL: ORA-00942: table or view does not exist V$SQL

查看:997
本文介绍了PL/SQL:ORA-00942:表或视图不存在V $ SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个过程,并在其中使用了以下语句.

I have created a procedure and used the below statement inside that .

select sql_id into v_sql_id from v_$sql where sql_text =v_sql;

我收到以下错误PL/SQL: ORA-00942: table or view does not exist

我已经检查了其所有者为PUBLIC的同义词,因此它应在这种情况下运行,但不起作用.

I have checked the synonym its owner is PUBLIC,so it should run in this case ,but its not working .

另一件事,我可以在简单的编辑器中select sql_id from v_$sql where sql_text =v_sql;.任何人都可以帮助我.

Another thing i can select sql_id from v_$sql where sql_text =v_sql; this in simple editor .Can anyone help me with this .

推荐答案

与数据库词典相关的表或系统表(在这种情况下为v_ $ sql)由Oracle sys用户拥有,并且需要特殊的特权才能访问它们.您需要以sysdba user身份登录到oracle数据库或获得这些特权(您的DBA可能会帮助您)来访问数据字典视图.

Database dictionary related or system tables (v_$sql in this case) are owned by Oracle sys user and needs special privileges to access them. You need to login to oracle database as sysdba user or get those privilages (your DBA might help you with this) to get access for the data dictionary views.

本文

The problem is that procedures don't respect roles; only directly granted rights 
are respected. So, that means that table_owner has to regrant the right to select

因此,请尝试以下操作在所有字典视图上授予SELECT权限,以便您可以在pl/sql块中使用它.

So, try the following to grant the SELECT on all dictionay view so that you can use it in your pl/sql blocks.

grant select any dictionary to USERNAME

这篇关于PL/SQL:ORA-00942:表或视图不存在V $ SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆