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;
I am getting the following error PL/SQL: ORA-00942: table or view does not exist
I have checked the synonym its owner is PUBLIC,so it should run in this case ,but its not working .
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 .
Database dictionary related or system tables (v_$sql in this case) are owned by Oracle
sysuser and needs special privileges to access them. You need to login to oracle database assysdba useror get those privilages (your DBA might help you with this) to get access for the data dictionary views.As mentioned in this article
So, try the following to grant the SELECT on all dictionay view so that you can use it in your pl/sql blocks.