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 from XML

836501Feb 3 2011 — edited Feb 3 2011
Hi to everyone,

I'm new in Oracle and I've - maybe trivial - a problem in a select. (I'm using Oracle 10g Express Edition).

I've a DB with a field CLOB: mytab.xml
This column have an XML like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<info>
<id> 954 </id>
<idboss> 954 </isboss>
<name> Fausto </name>
<sorname> Anonimo </sorname>
<phone> 040000000 </phone>
<fax> 040000001 </fax>
</info>

I'm trying to do a 'simple' select to get, for example, the value of 'fax' tag. But I've a bit of problem and I'm not able to understand my error. For example:

select extract(xml, '//fax').getStringVal() from mytab;
ORA-00932: inconsistent datatypes: expected - got

select extract(xmltype(xml), '//fax').getStringVal() from mytab;
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYS.XMLTYPE", line 254

I've tryed also with 'extractvalue', but I've the same problems.
where I'm wrong to do this?

Edited by: 833498 on 3-feb-2011 0.45
This post has been answered by odie_63 on Feb 3 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2011
Added on Feb 3 2011
6 comments
1,728 views