Any_help_with_this_xmlquerry
How do you count the datatype date using extract,extractvalue for xpath or xmlquery
in PL/SQL from the following xml file:
<conditions month="November 2005">
<date day="02">
<orientation rose="S">
<height unit="cm">3</height>
<quality>sping</quality>
</orientation>
<orientation rose="N">
<height unit="cm">10</height>
<quality>easy</quality>
</orientation>
<orientation rose="W">
<height unit="cm">7</height>
<quality>spring</quality>
</orientation>
<orientation rose="E">
<height unit="cm">10</height>
<quality>spring</quality>
</orientation>
</date>
<date day="03">
-<orientation rose="S">
<change unit="cm">10</change>
<quality>hard</quality>
</orientation>
-<orientation rose="N">
<change unit="cm">15</change>
<quality>hard</quality>
</orientation>
-<orientation rose="W">
<change unit="cm">15</change>
<quality>hard</quality>
</orientation>
-<orientation rose="E">
<change unit="cm">15</change>
<quality>hard</quality>
</orientation>
</date>
</conditions>
Any help on this..
thanks in advance
is this what you want ?
SQL> create table xml_table(xml_data xmltype)
2 /
Table created.
SQL> insert into xml_table values(xmltype
2 ('<conditions month="November 2005">
3 <date day="02">
4 <orientation rose="S">
5 <height unit="cm">3</height>
6 <quality>sping</quality>
7 </orientation>
8 <orientation rose="N">
9 <height unit="cm">10</height>
10 <quality>easy</quality>
11 </orientation>
12 <orientation rose="W">
13 <height unit="cm">7</height>
14 <quality>spring</quality>
15 </orientation>
16 <orientation rose="E">
17 <height unit="cm">10</height>
18 <quality>spring</quality>
19 </orientation>
20 </date>
21 <date day="03">
22 <orientation rose="S">
23 <change unit="cm">10</change>
24 <quality>hard</quality>
25 </orientation>
26 <orientation rose="N">
27 <change unit="cm">15</change>
28 <quality>hard</quality>
29 </orientation>
30 <orientation rose="W">
31 <change unit="cm">15</change>
32 <quality>hard</quality>
33 </orientation>
34 <orientation rose="E">
35 <change unit="cm">15</change>
36 <quality>hard</quality>
37 </orientation>
38 </date>
39 </conditions>'))
40 /
1 row created.
SQL>
SQL> select count(extract(value(x), '/date')) date_count
2 from xml_table
3 , table(xmlsequence(extract(xml_Data, '/conditions/date'))) x
4 /
DATE_COUNT
2
Similar Messages
Maybe you are looking for
-
Unable to Run/Deploy the Application
JDev 11.1.2.1.0 ADF BC I am unable to run my application and it gives the below log: *** Using HTTP port 7101 *** *** Using SSL port 7102 *** C:\Users\Administrator\AppData\Roaming\JDeveloper\system11.1.2.1.38.60.81\DefaultDomain\bin\startWebLogic.cm
-
I downloaded Itunes to my computer today to update my ipod's ios (4.2.1 yes i know im way behind) but when i click check for updates it tells me my ios is the current one. How can i fix this? please help!
-
How to have a value survive logout and destruction of the session
Hi, Currently I'm facing the following challenge: For a customer we are building a webcenter portal app (version 11.1.1.6). Depending on where you come from, customer wants to have different styles and template. I have done this by adding a URL param
-
Can't play movie from gallery on mac
I can not play movies from my gallery on my macbook. These movies are imported from Canon A630 to iPhoto. In iPhoto I can play them well. All of them are published to my mobileme gallery using iPhoto. Then I open this gallery in Safari on my macbook
-
Lost hp 8600 wireless password
I lost the password for my hp 8600 pro printer how do I recover it