Hi
I''m attempting to save plans (from V$SQL_PLAN) into a table using a procedure in schema APPS, but keep getting missing table error,
PL/SQL: ORA-00942: table or view does not exist
I then granted an explicit SELECT to APPS on the V$SQL_PLAN table from a schema with
a DBA role, but still get the same error when compiling the procedure.
SQL> create table gl_imp_post_plans as ( select * from v$sql_plan where rownum < 1);
Table created.
SQL> select count(*) from v$sql_plan;
COUNT(*)
----------
13506
SQL> create or replace procedure Ins_Plan_from_Dictionary as
2
3 begin
4 insert into GL_Imp_Post_Plans
5 select sqo.*
6 from v$sql_plan sqo
7 where (sqo.sql_id) not in (select distinct gipi.SQL_ID
8 from GL_Imp_Post_Plans gipi)
9 and (sqo.sql_id) in (select distinct
10 sqi.sql_id
11 from v$sql_plan sqi
12 where sqi.object_owner = 'APPS'
13 and sqi.object_name in ('GL_BALANCES','GL_DAILY_BALANCES','GL_JE_LINES') );
14 commit;
15
16
17 exception
18 when others then
19 rollback;
20 -- sysao_util.Message ('O', 'Error ' || sqlerrm);
21
22 end Ins_Plan_from_Dictionary;
23 /
Warning: Procedure created with compilation errors.
SQL> show err
Errors for PROCEDURE INS_PLAN_FROM_DICTIONARY:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/5 PL/SQL: SQL Statement ignored
11/40 PL/SQL: ORA-00942: table or view does not exist
SQL>
SQL> l 11
11* from v$sql_plan sqi
The same error occurs when I attempt to select from GV$SQL_PLAN or DBA_HIST_SQL_PLAN.
Could anybody suggest how I can persist the rows into a table using a procedure?
thanks