I have a XML in a clob column in a table. The XML is given below. In a SELECT query, I need to extract the values in xml. Please help.
<Driver>
<firstName>RAJ</firstName>
<lastName>KUMAR</lastName>
<licenses>
<License>
<licenseNumber>123456</licenseNumber>
<licenseType code="ABC"></licenseType>
</License>
<License>
<licenseNumber>XYZ123</licenseNumber>
<licenseState code="TN"></licenseState>
<licenseType code="General"></licenseType>
</License>
<License>
<licenseNumber>PK4363</licenseNumber>
<licenseState code="KL"></licenseState>
<licenseType code="CS"></licenseType>
</License>
</licenses>
<npiCode>9090909</npiCode>
<DriverAddresses>
<DriverAddress>
<addressLine1>SFDGSDF</addressLine1>
<city>Chennai</city>
<DriverContacts>
<DriverContact>
<faxNumber>1947</faxNumber>
<HphoneNumber>007</HphoneNumber>
<CPhoneNumber>345</CPhoneNumber>
</DriverContact>
</DriverContacts>
<state>KL</state>
<zipCode>600088</zipCode>
</DriverAddress>
</DriverAddresses>
<Drivertype code="AWD"></Drivertype>
</Driver>
I tried with
SELECT XMLTYPE(u.xmlcollumn).EXTRACT('/Driver/firstName/text()').getStringVal() from xmltable u;
But I am not able to get the child nodes and the element with code=" "
thanks, PK