• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1089
  • Last Modified:

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

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
wxII
Asked:
wxII
  • 2
2 Solutions
 
sdstuberCommented:
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
 
sdstuberCommented:
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
 
sujith80Commented:
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
 
wxIIAuthor Commented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now