I am having the same problem against a 10g DB.
I can run the suggested query from SQL*PLUS with no problems.
If I run the query without the "where" and "order by" clause it works fine.
If I run the query with the where clause it runs fine for about 600 records and then hangs and if I break out of it and display the error stack it displays the code below.
It seems to be hanging up on a specific schema's security priv's.
This is just a guess so please don't assume I know what I am talking about.
This could also be related to the version of the OCI.DLL
---------------------------------------------
create or replace function xdb.xdb$ExtName2IntName
(schemaURL IN VARCHAR2, schemaOwner IN VARCHAR2 := '')
return varchar2 authid current_user deterministic
is external name "EXT2INT_NAME" library XMLSCHEMA_LIB with context
parameters (context, schemaURL OCIString, schemaOwner OCIString,
return INDICATOR sb4, return OCIString);
-----------------------------
create or replace package body sys.xml_schema_name_present as
function is_schema_present(objname in varchar2,
userno in number) return number as
sel_stmt VARCHAR2(4000);
tmp_num NUMBER;
BEGIN
sel_stmt := ' select count(*) ' ||
' from user$ u, xdb.xdb$schema s ' ||
' where u.user# = :1 ' ||
' and u.name = s.xmldata.schema_owner ' ||
' and (xdb.xdb$Extname2Intname(s.xmldata.schema_url, s.xmldata.schema_owner) = :2)';
EXECUTE IMMEDIATE sel_stmt INTO tmp_num USING userno, objname;
/* schema found */
IF (tmp_num > 0) THEN
RETURN 1;
END IF;
sel_stmt := ' select count(*) '||
' from xdb.xdb$schema s ' ||
' where bitand(to_number(s.xmldata.flags, ''xxxxxxxx''), 16) = 16 ' ||
' and xdb.xdb$Extname2Intname(s.xmldata.schema_url,s.xmldata.schema_owner) = :1 ' ||
' and s.xmldata.schema_url ' ||
' not in (select s2.xmldata.schema_url ' ||
' from xdb.xdb$schema s2, user$ u2 ' ||
' where u2.user# = :2 ' ||
' and u2.name = s.xmldata.schema_owner) ';
EXECUTE IMMEDIATE sel_stmt INTO tmp_num USING objname, userno;
/* schema found */
IF (tmp_num > 0) THEN
RETURN 1;
END IF;
RETURN 0;
END;
end xml_schema_name_present;