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!

Extract XML data/element from BLOB column using PLSQL

user576711May 25 2007 — edited May 10 2013
Hi,

I have a table (Oracle 10XE) with two columns, 'ID' (Number) and 'ID_Details' (BLOB). Column 'ID_Details' is used to save XML document.

How do I extract XML document-elements from column type BLOB?

I have tried 'Extract', 'ExtractValue' and 'dburitype.createuri' functions but still getting following errors.

FUNCTION = getStringVal,getXML,getCLOB,getBLOB(873) [873 is csid for Characterset AL32UTF8]
----------------------------------------------------------------------
SELECT Extractvalue(x.ID_Details.FUNCTION()),'/Customer/Name') As XMLSrc FROM TableName x where x.ID = 12345;
SELECT Extract(x.ID_Details.FUNCTION()),'/Customer/Name') As XMLSrc FROM TableName x where x.ID = 12345;
SELECT Extract(x.ID_Details.FUNCTION()),'/Customer/Name/text(') As XMLSrc FROM TableName x where x.ID = 12345;
ORA-22806: not an object or REF
----------------------------------------------------------------------
SELECT Extract( x.ID_Details,'/Customer/Name/text()').Function() As XMLSrc FROM TableName x where x.ID = 12345;
SELECT ExtractValue( x.ID_Details,'/Customer/Name').Function() As XMLSrc FROM TableName x where x.ID = 12345;
ORA-00932: inconsistent datatypes: expected - got -
----------------------------------------------------------------------
select (dburitype.createuri('/Customer/Name')).getclob() As Results from (Select ID_Details from TableName where x.ID = 12345);
ORA-06553: PLS-306: wrong number or types of arguments in call to 'OGC_X'
----------------------------------------------------------------------

Thanks
Avi.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2013
Added on May 25 2007
9 comments
82,687 views