Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPath Query

Status
Not open for further replies.

avjoshi

IS-IT--Management
May 12, 2003
221
Hi,

I've posted this questions on 10g forum also. Since I saw more interaction on this one I am posting here again. If you don't discuss XML on this forum please excuse mu intrusion.

I am a complete Newbie to XML.

I registered the xml schema, which also created the XMLType table. (PurchaseOrder from Oracle Documentation) I alsoinserted one record into the table.

I can successfully extract the node using extract() function like so,
Code:
SQL> select extract(object_value,'/PurchaseOrder') from "PurchaseOrder2148_TAB";

EXTRACT(OBJECT_VALUE,'/PURCHASEORDER')
--------------------------------------------------------------------------------
<po:PurchaseOrder xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xmlns:po
="[URL unfurl="true"]http://xmlns.oracle.com/xdb/documentation/purchaseOrder"[/URL] xsi:schemaLocation="h
ttp://xmlns.oracle.com/xdb/documentation/purchaseOrder [URL unfurl="true"]http://xmlns.oracle.[/URL]
com/xdb/documentation/purchaseOrder.xsd">
<Reference>SBELL-2002100912333601PDT</Reference>
<Actions>
<Action>
<User>SVOLLMAN</User>
</Action>
</Actions>
<Reject/>
.....
.....
</PurchaseOrder>

SQL>
And now I am trying to extract value of reference column when I don't get any results back,
Code:
SQL> select extractValue(object_value,'/PurchaseOrder/Reference') from "PurchaseOrder2148_TAB";


E
-

SQL>
What am I doing wrong?

Any help on this would be greately appreciated.

Thanks,
AJ

Anand
 
Doesn't seem anything wrong with it. However, try this:

Code:
select extract(object_value,'/PurchaseOrder/Reference/text()').getStringVal() from "PurchaseOrder2148_TAB";

HTH
 
Thanks, I got it working :)

regards,
avj.

Anand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top