Hi all,
First let me set the scene. I am very new to XML and got a reasonable understanding of sql.
I have a database that amongst other things has a column in a table that contains the following XML.
"<Request action="Update">
<Personality>
<Identity><PersonIdentity><PersonNumber>187347</PersonNumber>
</PersonIdentity>
</Identity>
<JobAssignmentData><JobAssignment><JobAssignmentDetailsData><JobAssignmentDetails><BaseWageHourly></BaseWageHourly>
<DeviceGroupName>NW44</DeviceGroupName>
<PayRuleName>RT - 30 Min Auto Ded >39</PayRuleName>
</JobAssignmentDetails>
</JobAssignmentDetailsData>
<PrimaryLaborAccounts><PrimaryLaborAccount><EffectiveDate>15/08/2006</EffectiveDate>
<LaborAccountName>Food/North West RT/North West Region 4 RT/North West Area 44 RT/Late Shop Ellenbrook/-/-</LaborAccountName>
</PrimaryLaborAccount>
</PrimaryLaborAccounts>
</JobAssignment>
</JobAssignmentData>
<PersonInformationData><PersonInformation><BadgeAssignments><BadgeAssignment><BadgeNumber>187347</BadgeNumber>
<EffectiveDate>16/06/2006</EffectiveDate>
</BadgeAssignment>
</BadgeAssignments>
<CustomDataList><CustomData><CustomDataTypeName>AIS</CustomDataTypeName>
<Text></Text>
</CustomData>
</CustomDataList>
<EmploymentStatusList><EmploymentStatus><EffectiveDate>16/06/2006</EffectiveDate>
<EmploymentStatusName>Active</EmploymentStatusName>
</EmploymentStatus>
</EmploymentStatusList>
<ExpectedHoursList><ExpectedHours><Quantity>25</Quantity>
<TimePeriodTypeName>Weekly</TimePeriodTypeName>
</ExpectedHours>
</ExpectedHoursList>
<Identity><PersonIdentity><PersonNumber>187347</PersonNumber>
</PersonIdentity>
</Identity>
<PersonData><Person><AccrualProfileName>Holiday & Lieu Time</AccrualProfileName>
<BirthDate>03/07/1960</BirthDate>
<FingerRequiredFlag>True</FingerRequiredFlag>
<FirstName>Tracey</FirstName>
<HireDate>16/06/2006</HireDate>
<LastName>Howard</LastName>
<MiddleInitial></MiddleInitial>
<PersonNumber>187347</PersonNumber>
</Person>
</PersonData>
<PersonLicenseTypes><PersonLicenseType><ActiveFlag>TRUE</ActiveFlag>
<LicenseTypeName>Workforce_Timekeeper_Employee</LicenseTypeName>
</PersonLicenseType>
</PersonLicenseTypes>
<PostalAddresses><PostalAddress><City></City>
<ContactTypeName>5</C"
What I would like to is extract the personnumber shown in the first row. Have done muh research and I am trying to use the following script,
select EXTRACTVALUE(xmltype(xmlreqbody), '/Personality/Identity/PersonIdentity/PersonNumber')
from failedxmlbody
This will eventually be incorporated into a larger select statement that I have completed already. It's just this bit I need to get working.
Go easy on me, as I am new to this.
Thanks
First let me set the scene. I am very new to XML and got a reasonable understanding of sql.
I have a database that amongst other things has a column in a table that contains the following XML.
"<Request action="Update">
<Personality>
<Identity><PersonIdentity><PersonNumber>187347</PersonNumber>
</PersonIdentity>
</Identity>
<JobAssignmentData><JobAssignment><JobAssignmentDetailsData><JobAssignmentDetails><BaseWageHourly></BaseWageHourly>
<DeviceGroupName>NW44</DeviceGroupName>
<PayRuleName>RT - 30 Min Auto Ded >39</PayRuleName>
</JobAssignmentDetails>
</JobAssignmentDetailsData>
<PrimaryLaborAccounts><PrimaryLaborAccount><EffectiveDate>15/08/2006</EffectiveDate>
<LaborAccountName>Food/North West RT/North West Region 4 RT/North West Area 44 RT/Late Shop Ellenbrook/-/-</LaborAccountName>
</PrimaryLaborAccount>
</PrimaryLaborAccounts>
</JobAssignment>
</JobAssignmentData>
<PersonInformationData><PersonInformation><BadgeAssignments><BadgeAssignment><BadgeNumber>187347</BadgeNumber>
<EffectiveDate>16/06/2006</EffectiveDate>
</BadgeAssignment>
</BadgeAssignments>
<CustomDataList><CustomData><CustomDataTypeName>AIS</CustomDataTypeName>
<Text></Text>
</CustomData>
</CustomDataList>
<EmploymentStatusList><EmploymentStatus><EffectiveDate>16/06/2006</EffectiveDate>
<EmploymentStatusName>Active</EmploymentStatusName>
</EmploymentStatus>
</EmploymentStatusList>
<ExpectedHoursList><ExpectedHours><Quantity>25</Quantity>
<TimePeriodTypeName>Weekly</TimePeriodTypeName>
</ExpectedHours>
</ExpectedHoursList>
<Identity><PersonIdentity><PersonNumber>187347</PersonNumber>
</PersonIdentity>
</Identity>
<PersonData><Person><AccrualProfileName>Holiday & Lieu Time</AccrualProfileName>
<BirthDate>03/07/1960</BirthDate>
<FingerRequiredFlag>True</FingerRequiredFlag>
<FirstName>Tracey</FirstName>
<HireDate>16/06/2006</HireDate>
<LastName>Howard</LastName>
<MiddleInitial></MiddleInitial>
<PersonNumber>187347</PersonNumber>
</Person>
</PersonData>
<PersonLicenseTypes><PersonLicenseType><ActiveFlag>TRUE</ActiveFlag>
<LicenseTypeName>Workforce_Timekeeper_Employee</LicenseTypeName>
</PersonLicenseType>
</PersonLicenseTypes>
<PostalAddresses><PostalAddress><City></City>
<ContactTypeName>5</C"
What I would like to is extract the personnumber shown in the first row. Have done muh research and I am trying to use the following script,
select EXTRACTVALUE(xmltype(xmlreqbody), '/Personality/Identity/PersonIdentity/PersonNumber')
from failedxmlbody
This will eventually be incorporated into a larger select statement that I have completed already. It's just this bit I need to get working.
Go easy on me, as I am new to this.
Thanks