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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I read XML data in Oracle.

Status
Not open for further replies.

BJoy

Programmer
Feb 15, 2019
4
GB
Hi,
I'm new to oracle and would like to know how can I read XML in oracle like SQL SERVER Query. I know how I can do it in SQL Server (see the below code).
Would anyone be able to help me out please?

declare @XMLDoc xml
set @XMLDoc = '
<list>
<item uprn="64333" address="abcd" />
<item uprn="56789" address="xyz" />
<item uprn="12343" address="xxxx" />
</list>'
SELECT x.Item.value('@uprn', 'varchar(50)') uprns, x.Item.value('@address', 'varchar(50)') address FROM @XMLDoc.nodes('/list/item') AS x(Item);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top