PL/SQL loop counter for Xpath
251888Feb 18 2004 — edited Feb 20 2004I have an XML file that looks like this...
<COL-COMPET_LNG>
<COMPET_LNG>
<LNG_CODE>3</LNG_CODE>
<READ>O</READ>
<WRITE>O</WRITE>
<SPEAK>O</SPEAK>
<UNDERSTAND>O</UNDERSTAND>
</COMPET_LNG>
<COMPET_LNG>
<LNG_CODE>4</LNG_CODE>
<READ>O</READ>
<WRITE>N</WRITE>
<SPEAK>O</SPEAK>
<UNDERSTAND>O</UNDERSTAND>
</COMPET_LNG>
<COMPET_LNG>
<LNG_CODE>1</LNG_CODE>
<READ>O</READ>
<WRITE>N</WRITE>
<SPEAK>O</SPEAK>
<UNDERSTAND>O</UNDERSTAND>
</COMPET_LNG>
<COMPET_LNG>
<LNG_CODE>5</LNG_CODE>
<READ>O</READ>
<WRITE>N</WRITE>
<SPEAK>O</SPEAK>
<UNDERSTAND>O</UNDERSTAND>
</COMPET_LNG>
</COL-COMPET_LNG>
Using PLSQL I would like to loop though each node and process the /LNG_CODE value. I know how to set up the loop and how to access the /LNG_CODE values for each node. I am not sure how to count the number of occurrences of each <COMPET_LNG> node so that I can use it for my max count on the loop. Can anyone help?
Is there a good reference book I can use for this type of PL/SQL programming with XPath? I am using the Oracle manuals but I find the examples a little sparse and would love to read something with some good example code.
Thanks
Karen