PL / SQL: ORA-00942: the table or view does not exist. V $ sql

I created a procedure and used the instructions below.

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

I get the following error PL/SQL: ORA-00942: table or view does not exist

I checked the synonym, its owner PUBLIC, so it should work in this case, but does not work.

Another thing I can do select sql_id from v_$sql where sql_text =v_sql;in a simple editor. Can you help me with this.

+3
source share
3 answers

(v_ $sql ) Oracle sys . oracle sysdba user ( ), .

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 dictionay, pl/sql.

grant select any dictionary to USERNAME
+6

, , , , .

, , , PL/SQL.

SELECT .

+1

See my answer here . Perhaps this is due to the fact that you are using a certain capitalization somewhere

0
source

All Articles