How to count elements in a XMLTYPE of the same type?

Hi.
Imagine i have this inside a xmltype :
<world>Mercury</world>
<world>Venus</world>
<world>Earth</world>
<world>Mars</world>
Is there a way to query the xmltype (fast way) to return me 4 ?
Cheers!

Hello Everyone,
I have similar XML code but with more nodes within the nodes.
<root>
<world>
<moons>A</moons>
<moons>B</moons>
<moons>C</moons>
</world>
<world></world>
<world>
<moons>A</moons>
</world>
<world>
<moons>A</moons>
<moons>B</moons>
</world>
</root>
I can find out number of worlds count, which in this case is 4.
My problem is how to count number of moons for each world. I don't want the total moon count which is 6.
I want counts for World1 - 3, World2 - 0, World3 - 1, World4 - 2.
I am trying to retrieve the individual count like this
SELECT column_value INTO World_count
FROM XMLTable('count (//world)' PASSING xmltype ('<root>
<world>
<moons>A</moons>
<moons>B</moons>
<moons>C</moons>
</world>
<world></world>
<world>
<moons>A</moons>
</world>
<world>
<moons>A</moons>
<moons>B</moons>
</world>
</root>');
DBMS_OUT ('World Count:' || World_count);
For i IN 1 .. World_count
loop
SELECT column_value INTO moon_count
FROM XMLTable('count (//world/moon)' PASSING xmltype ('<root>
<world>
<moons>A</moons>
<moons>B</moons>
<moons>C</moons>
</world>
<world></world>
<world>
<moons>A</moons>
</world>
<world>
<moons>A</moons>
<moons>B</moons>
</world>
</root>');
DBMS_OUT ('For World : ' || i );
DBMS_OUT ('Moon Count is :' || moon_count);
end loop;
But its not giving me the right answer. Is my approach to the problem correct or do I need to do something else.
Please advice
Edited by: [email protected] on Mar 17, 2009 2:19 PM
Edited by: [email protected] on Mar 17, 2009 2:22 PM

Similar Messages

  • How to count frequency of two signal at the same time ?

    Hello every one
    please help me with this one i am really stuck.
    The situation   : I have two square wave signal, and i want to measure the frequency of both of themat the same time.
    the problem : Error -50103 occurred at DAQmx Read (Counter DBL 1Chan 1Samp).vi:3
    Please see the attachement.
    i also have 3 analog inputs to be measured.
    but i dont have any problem with the analog inputs,,,multiple analog  inputs can easily be measured,,,,,but the prob lem is in the digitl (square wave ) signals. 
    Attachments:
    i want to use two counter input.GIF ‏54 KB
    two counter tasks1.vi ‏250 KB

    NI has an excellent overview of the accuracy and tradeoffs of the different freq measurement methods titled  "Making Accurate Frequency Measurements."  To boil down the essence of it, the (possibly) increased accuracy of the 2-counter method depends on a relatively long collection / accumulation time which would in turn typically limit the rate at which you could update your measured freq value.
    Now let me offer some friendly but blunt advice.  LabVIEW makes it easy to collect data.  However, there are many other factors affecting the usefulness of that data.  I support the dictum: "It is hard to measure *well*."  Choice of sensors, their sensitivity to environment, various sources of noise, an understanding of the decision to be made from the data, programming methods, etc.  And even more etc.
    What I mean is that just because a hardware freq measurement can be performed that is precise to 1 part per million, it would be very RARE in a test that ALL of those 6 significant digits prove useful.  In your app, the measurements are presently only approximately correlated in time.  And the gap of blind time between measurements will usually represent a much longer period of time than the measurement itself.
    Analogy: suppose you had a 100 minute film at 25 frames/sec for a total of 150_000 frames.  Now start selecting individual frames that are separated by some random # of frames between about 200 and 500.  In the end, you may end up with a sequence of 400 frames in the correct order.  Each individual frame is VERY accurate, but the collection of all of them can zip by in 16 seconds and not give you a much understanding about the movie.
    What would usually work out much better is to sacrifice some accuracy in order to collect a greater quantity of frames.  You trade off the instantaneous accuracy for the overall coherency.
    Sorry, got on a roll...   Back to your question.  My own preference is almost always to avoid consuming hardware resources when not truly necessary.  I've been toying with counters for many years and have still never once deployed an app using a 2-counter frequency measurement.  I do the 1-counter measurement and save the other counter(s) for other purposes. 
    If you've got an M-series board, the 80 MHz timebase allows you to measure a 500 kHz pulsetrain with a quantization error of only about 0.06% (1 part in 160).  There's a pretty fair chance that whatever physical process emits that pulsetrain isn't appreciably more stable than that
    -Kevin P.

  • I have been having a issue with getting the colors on my monitor to match the colors fro my print lab. I now have the monitor calibrated to match the prints but when I open elements it doesn't use the same colors. If i have it use the calibrated profile b

    I have been having a issue with getting the colors on my monitor to match the colors fro my print lab. I now have the monitor calibrated to match the prints but when I open elements it doesn't use the same colors. If i have it use the calibrated profile by changing the color management settings, the color picker no longer shows true white or black. How do I get elements 12 to honor the new calibrated settings?

    Ok so I've done what you said and this is what it's come back ....
    I don't know that these are the errors , but they're the things which don't look right ...
    Throughout the shut down there is a recurring line ;
    It says ;
    Com.apple.launchd 1 0x100600e70.anonymous.unmount 301 PID still valid
    Then there are 2 more which I think are related ;
    Com.apple.securityd 29 PID job has I overstayed its welcome , forcing removal.
    Then the same with fseventd 48 and diskarbitrationd 13
    Oh and on Launchd1 : System : stray anonymous job at shut down : PID 301 PPID13 PGID 13 unmount...
    Then the last process says "about to call: reboot (RB_AUTOBOOT).
    Continuing...
    And stops ...
    Hope this means something to you ... Thanks again for your help so far :-)

  • Trying to install photoshop elements 11 and keep getting the same error message: "The installation process encountered an error while installing shared technologies."

    Trying to install photoshop elements 11 and keep getting the same error message: "The installation process encountered an error while installing shared technologies."

    Medops20 please see Install rollback and Shared Technologies | Windows for information on how to resolve the current error.

  • Is the EULA for Photoshop Elements 9.0 full version the same as the trial version?

    Is the EULA for Photoshop Elements 9.0 full version the same as the trial version?
    Is it acceptable to read the .pdf for Photoshop Elemetns 9.0 Full Version and then to install the trial version?
    Reading what I assume to be about 14 pages of dense A4 Text through a small windowed box is unnaceptable. How can I agree to something unless I have read it?
    Pete

    Hi Pete
    The trial is exactly the same as the boxed product.
    In fact if you purchase the boxed product from your favorite retailer you can simply enter the serial number from the DVD case into the trial to make it permanent - no further installation required.

  • Please resolve the Error:Element Entry over laps with another entry of the same type

    Hi Buddies,
                    I have been trying to resolve the error : Element Entry over laps with another entry of the same type while entering salary to an employee.
    I have tried to resolve this issue by created a new salary basis with new element. But still I could not make it.
    Please let me know how to move forward? Thanks for your help.
    Thanks
    Ganesh kumar M

    Hi Ganesh,
    We have a similar post which have some recommendation. please go through the comments and check if it helps.
    https://forums.oracle.com/thread/2440864
    Thanks,
    Sanjay

  • How do i start video and audio at the same time in ios

    How do i start video and audio at the same time in ios?
    I have tried a lot of different ways but i cant figure it out?
    I can get the sound and animation (timeline) to start playing.
    There is no problem to start the video and the animation at the same time.
    But i cant get both the video and the audio to start playing when i press a button.
    It works great in OSX and on windows?
    Here is an example:
    // insert code for mouse click here
    // Play an audio track
    sym.$("_1")[0].play();
    // Play a video track
    sym.$("host")[0].play();
    // Play the timeline at a label or specific time. For example:
    // sym.play(500); or sym.play("myLabel");
    sym.play("marker1");

    If the game has sound in it (and possibly even if it doesn't) it may be overriding the Music app and causing it to stop playing - in which case there is nothing that you can do about it.

  • How to connect our outbound function module to the message type

    how to connect our outbound function module to the message type any transcation code exits to assign the message type with the function module .
    Thank in advance .
    A. Thiru

    Hi Thiru,
    Standard Transaction Codes, have their own Function Modules for generating Outbound/Indbound Idocs. Where these Function Modules will be configured to a particular Process Codes.
    For E.g for PO's
    Process code : ME10 - IDOC_OUTPUT_ORDERS - for creation
    In case if its a Z Function Module, It depends on the case how you use IDOC types. either directly through Z Program or through Inbound/Outbound Process  codes with respective Function modules.
    Regards,
    Anbalagan

  • How far will the extreme reach and how many users can be on there at the same time?

    How far will the airport extreme reach and how many users can be on there at the same time?

    Last question first, since that is the easy one......approximately 50 (fifty) users for wireless depending on how active each user might be.
    The first question is much more difficult, as distance is not really the issue with wireless.....obstructions are the issue.
    A wireless signal can easily travel 300 feet or more with no obstructions in the signal path.
    But, a typical wall of sheetrock or wallboard in a home will absorb....on average....15-20% of the wireless signal. Brick or adobe will obviously absorb much more. A ceiling....because it is thicker....will absorb about 25-35% of the signal.
    So, if the wireless signal must pass through several walls and a ceiling, there won't be much, if any, of the signal left....even though the distance that the signal travels is not great...for example, 20-25 feet.
    Other wireless networks around you at the neighbors can also affect the relative strength of the wireless signal.
    The bottom line....locate the AirPort Extreme where wireless devices will receive a signal with the least amount of obstructions in the signal path. Your actual performance cannot be predicted in advance. You will not know how well the AirPort Extreme works for you until you try it out in your home.
    If you find that the signal does not reach as far as needed,  you will need to add additional "extenders", like an AirPort Express to provide more signal coverage.

  • How do I combine text and photos on the same page in iPhoto using photobook

    How do I combine text and photos on the same page in iPhoto using photobook?

    You mean while creating a book in iPhoto?  Click on the layout button while viewing a page and select the layout that includes both text and photos.  Most themes will have those options.
    OT

  • How can install a second app icon  of the same on app on a different home screen?

    how can install a second app icon  of the same on app on a different home screen?
    for example i have the phot app on one home screen and the i want the same photo app showing on the other home screens?
    I want to have a duplicate app on on more than one home screen
    Another example if i have the Evernote app showing on my first home screen and then my last home screen as well

    Put it in the dock at the bottom. Apps put there stay there and show at the bottom of all home screens.

  • How to sync 2 different Mac users using the same Apple ID and with out mixing each other info?

    How to sync 2 different Mac users using the same Apple ID and with out mixing each other info?
    We are two people using three difrent Macs, 1 Iphone and 1 Ipad with separate USERS  on each Mac but sharing the same Apple ID: xxxxxx
    I set up the first user to iCloud and it was OK but when I set up the second user to use iCoud the first users's info gets mixed with the second user's info?
    Do we have to set up a diffrent Apple ID for each other?
    Sometime ago I added my friends E mail (yyyyy) to the main Apple ID (xxxx) as for using his E mail account (to separate our e mail accounts, and it's working ok) but now when I try to create a new apple ID whith the same friend's e mail (yyyyyy)  it says that his mail (yyyyy) is already an apple ID when the Apple ID is really my E mail (xxxxx)... any clue?
    Thanks

    I believe because you migrated from a Nokia to an iPhone you need to register the Bn phone number with your Apple ID so it can be used for iMessage. The Pn number seems to be the only one registered
    Go here > https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
    Manage your Apple ID and see if that does the trick
    Hope that helps

  • How can i create multiple accounts but use the same itunes?

    how can i create multiple accounts but use the same itunes?

    Hi iCloud is Making Me Go Crazy,
    You will need to create a new Apple ID for your GameCenter and iCloud services.  You can continue to use the current Apple ID you share with your Mom for access to iTunes Store purchases if you wish. 
    Using your Apple ID for Apple services
    http://support.apple.com/kb/HT4895
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    Cheers,
    - Judy

  • HT1451 Hi All, I have 2 users on my desktop, 1 i-tunes account and log-in but both users have different music contents i.e. one has the full iTunes library and the other only has some songs. How do i get both users to have the same music content?

    I Have 2 users on my computer and both access i-tunes using same password etc. however 1 library has the full content of music but the other one has only partial playlists. How do I get both users to have the same full library?

    The title of my initial post is a bit misleading. I already took a chance deleting one of the iPhones, hoping if I deleted the wrong one, I can still reauthorize it (all with the same Apple ID acct, so not subject to 90-day waiting period, right?) The iTunes database just updated itself, and it says I have 4 "devices" "in the Cloud", but 5 "computers" associated w my account. How can I find out what computers are associated? Isn't there a list I can see? I dont have a clue what computers they might be. If I use the  "Deauthorize All" option, is it a pain to add them all back in. I assume I would have to log in from each computer to reauthorize each one. Would I have to be running the newest OS or version of iTunes to reauthorize? I think I have a PowerBook G4 Titanium with an older OS and iTunes. I'd like to keep that authorized, if possible.

  • HT5538 How do you separate multiple iOS devices using the same apple id account for Face Time calls and iMessaging?

    How do you separate multiiple ios devices using the same apple id account for Face Time calls and iMessaging?

    The only way I have seen is to have each device use a if fervent email account, if they all are on the same email the FaceTime connection is either to a phone number or to an email address.  If they ar all on the same email, it is up to the user to decide which to use.

Maybe you are looking for

  • SAP BPC 7.0NW (project in Ramp-Up)

    Hi, We are doing 2 Ramp-Ups currently on the BPC for Netweaver version, and I have a question relating to script logic. Knowing the Microsoft version very well, we are quite experienced with using logic for budgeting or forecasting purposes. I have r

  • How to create a "Firefighter" type role when we do not have GRC

    I am just looking for advice or input on this situation. Currently my company does not have GRC or any other type of software that will allow for automated Firefighter type access and apparently there are no plans in the near future to purchase anyth

  • How can i turn on the audio on my iPad?

    I've turned off the mute option, but I still have no audio in iTunes or in Skype or anything else.

  • Set values

    Dear Guru, I tried using the below codes to set the dropdown default. But it does not seem to filter as intended. Also, just to confirm if I should still set the query value if I am using a view instead and must I also set the infocube value if I am

  • How do i link photoshop 5.1 to the Lightroom 4 edit in command

    I still have my photoshop 4 in the edit in command but the 5.1 link has disappeared. How do i restore it???