Home » Developer & Programmer » JDeveloper, Java & XML » FOR ORDINALITY Read order
FOR ORDINALITY Read order [message #653211] Wed, 29 June 2016 04:09 Go to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Morning folks.

Given the below:
with t as (select xmltype('<ROOT>
                           <Name>
                                <FirstName>FLOKI</FirstName>
                                <LastName/>
                           </Name>
                           <Name>
                                <FirstName>RAGNAR</FirstName>
                                <LastName>LOTHBROK</LastName>
                           </Name>
                           <Name>
                                <FirstName>SIGURDUR</FirstName>
                                <LastName>JOHANSSEN</LastName>
                           </Name>
                           </ROOT>
                           ') xml from dual)
select x.nameid
     , x.lastname
     , x.firstname
from t
     , xmltable(xmlnamespaces('urn:oecd:ties:stffatcatypes:v1' as "n2")
                , 'ROOT/Name'
                 passing t.xml
                 columns
                   nameid for ordinality
                 , lastname      varchar2(50)    path '//LastName'
                 , firstname     varchar2(50)    path '//FirstName'
                 ) x;

Can I be assured that the nameid ordinality derivation will always be the same. i.e. it does not require any 'order by' code to ensure the order (as we would with sql extracting data from a table) , rather the order is effectively a 'read' order based on a top-down approach. And so assuming that the source xml remains the same the nameid values will remain the same for each time the code is executed.

I appreciate that I might not be entirely clear here so if any further info is required, please let me know.
Re: FOR ORDINALITY Read order [message #653212 is a reply to message #653211] Wed, 29 June 2016 04:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

As far as I can estimate, I'd say you can, I don't see another way to analyze an XML string than from first character to last one and so ORDINALITY should be always the same one for the same place in the string but nothing is mentioned in the documentation, maybe a SR...

Re: FOR ORDINALITY Read order [message #653213 is a reply to message #653212] Wed, 29 June 2016 04:33 Go to previous message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
Nice one, always nice to get the same conclusion as yourself Michel Wink
Cheers.
Previous Topic: How to download Plugins for offline installation for Firefox and Internet Explorer to run Fusion Middleware Forms 11g in client pc's not having Internet Access?
Next Topic: Load XML file using xmltype
Goto Forum:
  


Current Time: Thu Mar 28 12:58:19 CDT 2024