Solved

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

Posted on 2008-10-30
4
1,056 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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.

863 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

24 Experts available now in Live!

Get 1:1 Help Now