Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

issue with query running slow and ORA-22905

User12820770-OracleDec 6 2010 — edited Dec 8 2010
Hi
I am looking after a test DB, which is an import of a user schema from production DB. Now unfortunately in production they crate some object types in the user schema ( I know that's a bad idea, should be in types schema for instance ).
Anyway in our test env, this is then imported to 3 separate schemas, using fromuser/touser, so the import log has these errors IMP-00017: following statement failed with ORACLE error 2304:
"CREATE TYPE "OBSOLETESPID" TIMESTAMP '2004-03-12:00:10:50' OID 'CB80233DBEC"
"45D16E034080020ACAB66' "
" as object (OBSOLETES_PID varchar2(16));"


anyway, I drop the "type force" in the schema for the types and recreate via
create or replace type OBSOLETESPID TIMESTAMP '2004-03-12:00:10:50' OID 'CB80233DBEC45D16E034080020ACAB66' as object (OBSOLETES_PID varchar2(16));
create or replace type OBSOLETESPIDLIST TIMESTAMP '2007-03-26:12:19:34' OID '2C99726ADF1523C3E044080020ACAB66' as table of OBSOLETESPID;


Now this works ok, but now we appear to have a related issue where a function is running slowly, this function ( an excerpt ) is:
select s.text from USER_source s where s.name='<func-name-removed>'

function <func>(pid in varchar2) return OBSOLETESPIDLIST is

cursor c_<fuc>(ppid in varchar2) is
select acc.obsoletes_pid
from acc_obsoletes acc, patchmain main1
where main1.pid = ppid

TEXT
--------------------------------------------------------------------------------
and main1.pid = acc.pid
union
select max(pid)
from patchmain
where patchid = substr(ppid, 1, 6)
and pid < ppid;
cursor c_getdistinctacc(cumulative OBSOLETESPIDLIST) is
select distinct obsoletes_pid from table(cumulative);
cursor c_getinstance(ppid in varchar2) is
select pid from patchmain where pid = ppid;
cumulative OBSOLETESPIDLIST := OBSOLETESPIDLIST();

TEXT
--------------------------------------------------------------------------------
ucumulative OBSOLETESPIDLIST := OBSOLETESPIDLIST();
history OBSOLETESPIDLIST := OBSOLETESPIDLIST();
prevhistory OBSOLETESPIDLIST := OBSOLETESPIDLIST();
cidx number := null;
hidx number := null;
prevhidx number := null;
pidinstance varchar2(16) := null;
begin
......


when I run this the query takes around 3 times longer in test than production, consistent gets is very high in comparison.
i ran tkprof after setting sql_trace=true and see

SELECT DISTINCT OBSOLETES_PID
FROM
TABLE(:B1 )
...
error during execute of EXPLAIN PLAN statement
ORA-22905: cannot access rows from a non-nested table item

parse error offset: 104


I don't have access to production trace directories so unable to trace live query, but have strong suspicion that somehow in my test DB, the create type is still broken, i can run
alter function <func> compile and show errors is empty, but currently am interested in resolving the ORA-22905, query returns ok but is taking in the order of minutes to complete.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 5 2011
Added on Dec 6 2010
2 comments
402 views