Solved

select xmltype column record/xml fragments and store it in associative array in plsql

Posted on 2008-10-30
4
1,052 Views
Last Modified: 2013-12-07
hi experts,

i'm trying to select an xml elements/attributes value from xmltype column and store it in associative array for further looping requirement. what i don't really get it is in pl/sql, value extracted using xpath from xml document is in a list of xml fragments(element/ attribute values). what type should i declare to hold this information?

please advise and thanks,
wxII
0
Comment
Question by:wxII
  • 2
4 Comments
 
LVL 73

Expert Comment

by:sdstuber
ID: 22847366
what version of Oracle?  It helps to us to give answers, and also for you to get the attention of more people if you include the zones for the version you are interested in.
0
 
LVL 73

Accepted Solution

by:
sdstuber earned 250 total points
ID: 22847380
for this particular question though, the answer will likely be version independent.  The return type will be xmltype.  Unless you explicitly extract the text of a node or the values within a node or attribute.  Then they will be varchar2.

What are you trying to do?  Are you sure you want to pull the data out into a collection?  Why not just iterate through the xml docment itself or open a cursor.
0
 
LVL 27

Assisted Solution

by:sujith80
sujith80 earned 250 total points
ID: 22847543
Generally VARCHAR2 should do. If the size of the extracted fragment is greater than 32k you may use CLOB.

THe return value of the extracted value depends on which function you are using EXTRACT/ EXTRACT VALUE.

Read the oracle documentation on this.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions051.htm
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions052.htm
0
 

Author Comment

by:wxII
ID: 22848520
the version i'm using is oracle 11g 11.1.0.6.

 the reason i'm storing it in associative array is because i 'm gonna use it for referencing with other relational table. the xml column only contains the hierarchical format. since storing hierarchical format using conventional relational table is very tedious, so i decided to use xml where the nature of it is hierarchical.

another supporting reason for this is because i want to limit the query on data as much as possible by query once for all the hierarchical data that i need and just process it with iteration and conditional situation.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now