Difference between two XMLTYPE data types

datatypesoracle

In Oracle Database, there are two XML-related data types, SYS.XMLTYPE and PUBLIC.XMLTYPE.
What is the difference between them?

Best Answer

That's simple.

Check the object type of the "public" object

select object_type
from all_objects
where owner = 'PUBLIC'
and object_name = 'XMLTYPE';

the above returns

OBJECT_TYPE
-----------
SYNONYM    

So we have to look into all_synonyms:

select owner, synonym_name, table_owner, table_name
from all_synonyms
where synonym_name = 'XMLTYPE';

returns:

OWNER  | SYNONYM_NAME | TABLE_OWNER | TABLE_NAME
-------+--------------+-------------+-----------
PUBLIC | XMLTYPE      | SYS         | XMLTYPE