Get specific information from XML using PLSQL

Hi friends,

XML entry

' <? XML version = "1.0" encoding = "UTF-8"? >

< major >

< minor >

< > 12345 line_id < / line_id >

< service_Line >

< > 1111 line_id < / line_id >

< product_id 56789 > < / product_id >

< / service_Line >

< service_Line >

< > 22222 line_id < / line_id >

< / service_Line >

< service_Line >

< > 3333 line_id < / line_id >

< > 23456 product_id < / product_id >

< > 999999 product_id < / product_id >

< / service_Line >

< service_Line >

< > 4444 line_id < / line_id >

< / service_Line >

< / minor >

< service_Line >

< > 5555 line_id < / line_id >

< > 666666 product_id < / product_id >

< > 121212 product_id < / product_id >

< / service_Line >

< service_Line >

< > 5555 line_id < / line_id >

< / service_Line >

< / major >

`

from the above XML code

I want the line_id and the Product_id of the tag service_line and ignore the line_id in the tag of service_line that does not product_id

so I need the information below

Service_line

product_id

1111

56789

3333

23456

3333

999999

5555

666666

5555

121212

Or as

Service line - 1111

Product_id - 56789

Service - line 3333

Product_id -23456

Product_id - 999999

Service - line 5555

Product_id -666666

Product_id - 121212'

Oracle version:

PL/SQL Release 11.2.0.3.0 - Production

Thanks in advance

Come on... I have already answered here: Re: Re: parsing XML and get the required data only PLSQL using

Please stay focused

select x.*
from xmltable(
       xmlnamespaces(default 'urn:xyz:ccw:config:common:data')
     , 'for $i in //serviceLine
          , $j in $i/coveredProduct
        return element r {
          $i/lineId
        , $j/childProductLineId
        }'
       passing v_xml_response
       columns seq_id for ordinality
             , child_product_line_id  number path 'childProductLineId'
             , service_line_id        number path 'lineId'
     ) x ;

Tags: Oracle Development

Similar Questions

  • Get specific information from executives of related texts

    Hi all

    So here's my question. I need to get information from text within a thick layer. The layer contains images and text and the text is the information that I need, which looks like this:

    (4) L attest 1,2,3,4

    (13) XL 5,7,8,9,10,11,12,14,15,17,19,20,21 bolt torque

    (4) bolt torque 22,23,25,27 XXL

    (1) XXXL 34 bolt torque

    I need to do three things: the number that represents the number inside the parenthesis, the size that it is the next set of letters (L, XL, XXL, XXXL) and the list of numbers (I need not "# s" characters), and information storage together to know for example that size L has a 4 number and numbers are 1,2,3 and 4.

    If someone could point me in a direction to achieve this I would really appreciate it. I'm working on CS6.

    Thank you.

    This is not EXACTLY how I described above... but this is the one I tested with. It doesn't have the conditional statement about whether she should use asterisks or peren and me have just pre-programmed the chain of the textFrame. It worked for me. It will be perhaps more useful than this wall of text and attempts at explanations...

    function getRoster()
    {
        var roster = {};
    
        var text = "(4) AL #'s 1,2,3,4\
        (13) AXL #'s 5,7,8,9,10,11,12,14,15,17,19,20,21\
        (4) AXXL #'s 22,23,25,27\
        (1) AXXXL #'s 34\
         \
        TOTAL: 22"
    
        var lines = text.split('\n');
    
        roster["sizes"] = {};
    
        for(var a=0;a5 && lines[a].indexOf(":") == -1)
            {
                var qty = lines[a].substring(lines[a].indexOf("(")+1, lines[a].indexOf(") "));
                var size = lines[a].substring(lines[a].indexOf(") ")+2, lines[a].indexOf(" #"));
                var nums = lines[a].substring(lines[a].indexOf("s ") + 2, lines[a].length);
                nums = nums.split(",");
    
                roster["sizes"][size] = {};
                roster["sizes"][size]["quantity"] = qty;
                roster["sizes"][size]["numbers"] = nums;
            }
        }
        return roster;
    }
    var theRoster = getRoster();
    

    This script returns the next object and saves it under theRoster:

    var theRoster = {
         "sizes" : {
              "AL" : {
                   "numbers": ["1", "2", "3", "4"],
                   "quantity" : 4
              },
              "AXL" : {
                   "numbers":["5","7","8","9","10","11","12","14","15","17","19","20","21"],
                   "quantity" : 13
              },
              "AXXL" : {
                   "numbers": ["22","23","25","27"],
                   "quantity" : 4
              },
              "AXXXL" : {
                  "numbers" : ["34"],
                   "quantity" : 1
              }
         }
    
  • Get 7 Volume Info.vi returns an error when you try to get the information from disk on the cRIO-9025

    Hello

    I use a cRIO-9025 controller and want to get the information from the c: disk volume using the function to read the Volume information in the palette file I/O. When I run the function with the path as "C:\". ", the function returns a 7 error indicating that the path is incorrect.

    I used this function before with cRIO but unfortunately I have not any older devices with me to check this out now. I'm using LabVIEW 2009 SP1.

    Thank you very much!

    See you soon!

    Sankah2k

    On real-time targets VxWorks, the root of the path of the file is here (in lowercase). Try and let us know if it works. You would be better to use the constant path of the file to understand what looks like the path of the root directory.

  • Where can I get my information from pop3 to set up my e-mail account?

    Original title: "windows mail"

    How can I set up mail windows using windows vista? where can I get my information from pop3 to set up my e-mail account?

    Thank you

    How can I set up mail windows using windows vista? where can I get my information from pop3 to set up my e-mail account?

    Thank you

    http://www.SimpleHelp.NET/2007/02/07/a-beginners-guide-to-setting-up-Windows-Mail/

    Link above has an easy to follow Guide to set up Windows Mail.

    Contact your ISP (Internet Service Provider).

    They offer your broad band/Dial-up connection.

    Ask them to:

    username
    password for your service account to wide band/Dial-Up with them

    Server of incoming POP3 mail
    outgoing mail SMTP server

    The above information is required to set up Windows Mail.

    ISPS are usually happy to help you set up your email account.

    See you soon.

    Mick Murphy - Microsoft partner

  • What is the command of shortcut for all windows get the information from the computer?

    What is the command of shortcut for all windows get the information from the computer?

    instead of going to the computer / my computer > properties > discover the pc... basic information or go to the control panel...

    just a command for windows xp, vista, 7 for system looking for information....

    original title: what is the SHORTCUT COMMAND to get information from the computer system?

    Hello BlackSecret,

    The keyboard shortcut to get to the top of this information is Windows key + break Attn.

    Who does what you ask?
  • Parsing XML and get the required data only using PLSQL

    Hi friends,

    I have a XML data

    < MAJOR_LINE >

    < LINEID > 143424538 < / LINEID >

    nom_element < ITEMNAME > = < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < MINORLINE >

    < LINEID > 143424799 < / LINEID >

    TCC_ITEM_NAME < ITEMNAME > < / ITEMNAME >

    < > 78245 ITEMPATH < / ITEMPATH >

    < QUANTITY > 10 < / QUANTITY >

    < MINORLINE LINEID = "123456_line_id" xmlns = "xxyyzz" >

    < message > < / message >

    < status > < / status >

    < covered_Product_line_id > '123_coveredProductLineID '.

    < / covered_Product_line_id >

    < itemName > < / itemName >

    < quantity > < / quantity >

    "< service lineId ="456_service_line_id">."

    "< covered_Product_line_id >"123_coveredProductLineID"

    < / covered_Product_line_id >

    < productAttributes / >

    < itemType > < / itemType >

    < itemPath > < / itemPath >

    < coveredProducts childProductLineId = "" / > "

    < / coveredProducts >

    < parentCoverage / >

    < / service >

    < / MINORLINE >

    < / MINORLINE >

    < / MAJOR_LINE >

    I want to extract only the Covered_product_line_id and the Service_line_id of the above XML format, these data can come from any where in the xml file and the xml can be any length.

    First we need to find the covered_product_line_id and the service_line_id associated with line_id, (as I pointed out in bold) here only a single pair i showed, but it can be in any number. (Note the line_id is inside the tag).

    #PLSQL

    Help, please.

    Thanks in advance

    Hey Odie,

    Me do string literal too long error:

    Select x.*

    from xmltable)

    XmlNamespaces(default ')

    , ' for $i in //serviceLine

    , $j in $i / coveredProduct

    Returns the element r {}

    $i / lineId

    , $j/childProductLineId

    }'

    from xmltype (')

    45146937

    N20

    1

    63090598

    CON-S

    1

    SNT

    UCS - IOM

    342544294

    N20-FW012

    342544295

    342544294

    UCS-IOM2

    1

    N20-C6508-UPG:

    45146937

    CON-S

    1

    SNT

    342544295

    N20-FW012

    1

    N20-C6508-UPG:

    45146937

    CON-SN

    1

    SNT

    342544296

    FET - 10G

    16

    N20-C6508 - UPG:U SC EXPERIENCE

    342544297

    UCSB-5108-PKG-FW

    1

    N20-C6508-UPXPANSION O

    342544298

    N20-CBLKP

    2

    N20-C6508 - UPG:0 - CBLKP

    342544299

    N01-UAC1

    1

    N20-C6508 - UPG:N01 - UAC1

    342544300

    N20-CBLKI

    1

    N20-C6508 - UPG:U HC EXPANSION OPT: N20-CBLKI

    342544301

    N20-FAN5

    8

    N20-C6508 - UPG:U HC EXPANSION OPT: N20-FAN5

    342544302

    N20-CBLKB1

    6

    N20-C6508-UPG-CBLKB1

    342544303

    N20 - CAK

    1

    N20-C6508-OPT: N20 - CAK

    342544304

    UCSB-B420-M3-D

    1

    N20-C6508-UP-B420-M3-D

    63090594

    CON-SNT-B420M3D

    1

    SNT

    UCS-UC-E5-4617

    342544305

    UCS-ML-1X324RY-A

    342544306

    342544305

    UCS-UC-E5-4617

    2

    N20-C6508 - UPG:PU - E5-4617

    342544304

    CON-SNT-B420M3D

    1

    SNT

    342544306

    UCSRY-A

    2

    N20-C624RY-A

    342544304

    CON-SNT-B420M3D

    1

    SNT

    342544307

    UCS0MS

    1

    N FIO-1600MS

    63090595

    CON-SNT-FIOB16MS

    1

    SNT

    342544308

    N2KD

    4

    N20-C6LKD

    342544309

    UCSB-HS-01-EP

    2

    N20-C65B-HS-01-EP

    342544310

    N1K-VSG-UCS-BUN

    1

    N20-C6508 - UPG:U-BLA1K-VSG-UCS-BUN

    342544311

    VSG-VLEM-UCS-1

    1

    N20-C6508 - UPG:U BLN1K BUN: VSG-VLEM-UCS-1

    63090596

    CON-SAU-VSGUCS

    1

    SAU

    342544312

    N1K-VLEM-UCS-1

    1

    N20-C6508CS-BUN: VMW N-UCS-1

    63090597

    CON-SAU-VLEMUCS

    1

    SAU

    342544313

    UCSB-ACDV

    2

    N20ACDV

    342544314

    R2XX-DMYMPWRCORD

    2

    PWRCORD N20 - C6

    ')

    columns for the ordinalite seq_id

    , path number child_product_line_id "childProductLineId".

    , service_line_id number path "lineId.

    ) x ;

  • How can I get specific information on my DVD reader/burner? I would get the name of the manufacturer and model number, for example.

    I just bought '100 DVD + R16X for professional' discs to Taiyo Yuden to use for the archiving of the files on my computer.  There is a notice that came with the discs saying they are nine 1 x-16 x speed DVD + R (Compatible high-speed drive), and should I make sure my Player DVD is in line with the new 1 x-16 x recording standard.

    I would like to know how can I determine if my drive is in line.  The information I could get, is that the drive is a device of "ATAPI DVD W DH16w1P ATA."

    Maybe if I can learn more about the manufacturer and the model I can find if the drive conforms to the standard.

    I'd appreciate any help!

    Hello tjjfitz,

    Great choice in the media from Taiyo Yuden which is one of my favorites (Japan, Singapore, Taiwan) for their dyes they use! Regardless of speed, use the slowest speed to burn your backups, they will last longer and are less likely to contain errors. I burn my backups at 4 x which, Yes is slow, but the quality of combustion is what matters when you want to get more long shelf life of your discs. I also recommend Virbatum (Japan, Singapore, Taiwan) too! Hope this helps you. Let us know anyway. Make it a great day!

    "And in the end the love you take, is equal to The Love You Make" (The Beatles last song from their latest album, Abbey Road.)

  • To remove data XML from XML using REGEXP_REPLACE tags

    Hello

    I try to use the SQL REGEXP_REPLACE function on a piece of XML, to remove the actual XML data from the weather. My ultimate goal is to end up with a list separated by commas to names of XML elements. In the first stage, I want to just pull all of the actual data.

    I tested the following query, and it initially appeared to work:
    SELECT REGEXP_REPLACE('&gt;THIS IS A TEST&lt;', 
                          '&gt;([[:alnum:]]\s|\S)*&lt;',
                          '&gt;&lt;' ) AS test_result
      FROM dual;
    Unfortunately, when I applied it to a full XML string, it did not. Here is the query to test that I used:
    SELECT REGEXP_REPLACE('&lt;ROW&gt;&lt;TEST_ELEMENT1&gt;123&lt;/TEST_ELEMENT1&gt;&lt;TEST_ELEMENT2&gt;THIS IS A TEST!&lt;/TEST_ELEMENT2&gt;&lt;/ROW&gt;',
                          '&gt;([[:alnum:]]\s|\S)*&lt;',
                          '&gt;&lt;') AS test_result
      FROM dual;
    I found myself with the following result:

    * & lt; LINE & gt; & lt; / LINE & gt; *

    What I was trying to a:

    * & lt; LINE & gt; & lt; TEST_ELEMENT1 & gt; & lt; / TEST_ELEMENT1 & gt; & lt; TEST_ELEMENT2 & gt; & lt; / TEST_ELEMENT2 & gt; & lt; / LINE & gt; *

    If you are reading this and you are a Posix regular expression guru, could you let me know exactly where I am going wrong? Regular expressions are not my strong point, but I would better go home.

    Hello

    For your final requirement, the 'commas list names of XML elements', what using XQuery with something like:

    SELECT xmlquery(
      'string-join( for $i in $d//*
                    return local-name($i), "," )'
      passing xmltype('123THIS IS A TEST!') as "d"
      returning content
    ).getStringVal()
    FROM dual;
    
  • Assign colors to Flash object from XML using AS3

    Here I create a dynamic square and trying to assing a color of XML data

    I have the XML file with color code

    < data >

    < color >

    0x0000FF

    < / color >

    < / data >

    I need to add this flash object color using action script

    var xmlLoader:URLLoader = new URLLoader();

    var: col: uint;

    xmlLoader.load (new URLRequest ("linkNewD.xml"));

    xmlLoader.addEventListener (Event.COMPLETE, displayHTML);

    displayHTML function (e: Event): void

    {

    var xmlData:XML = new XML (e.target.data);

    var cData:String = xmlData.colour.toString ();

    trace (cData); 0x0000FF

    col = uint (cData); 255

    //col = uint (xmlData.colour.toString ());

                    trace (col);

    }

    var square: Sprite = new Sprite();
    addChild (square);
    square.graphics.lineStyle(3,0x00ff00);
    square.graphics.beginFill (0x0000ff); square.graphics.beginFill (col);
    square.graphics.drawRect (0,0,100,100);
    square.graphics.endFill ();

    Square.x = stage.stageWidth/2-square.width/2;
    Square.y = stage.stageHeight/2-square.height/2;

    Please help me!

    Thank you

    jafy

    then use:

    var xmlLoader:URLLoader = new URLLoader();

    var: col: uint;

    xmlLoader.load (new URLRequest ("linkNewD.xml"));

    xmlLoader.addEventListener (Event.COMPLETE, displayHTML);

    displayHTML function (e: Event): void

    {

    var xmlData:XML = new XML (e.target.data);

    var cData:String = xmlData.colour.toString ();

    squareF (cData);

    }

    function squareF(colS:String):void {}

    var square: Sprite = new Sprite();
    addChild (square);
    square.graphics.lineStyle(3,0x00ff00);
    square.graphics.beginFill (uint (passes));
    square.graphics.drawRect (0,0,100,100);
    square.graphics.endFill ();

    Square.x = stage.stageWidth/2-square.width/2;
    Square.y = stage.stageHeight/2-square.height/2;

    }

  • Is there a way to remove the changes to the URL bar, specifically information from State and URL target?

    For starters, I totally despise changes to the URL bar and the removal of the status bar. In order to stay with the latest version of Firefox, I try to recreate the look and feel better than I can.

    I have already installed the extension of the State-4-Evar. The only thing left is to delete the status information and the URL target of the bar.

    Y at - it none of the parameters of topic: config that will allow me to make these changes?

    EDIT: The State information can be removed by activating / deactivating. status4evar.statusInUrlBar. always looking for a way to remove the URL target...

    Copy the following code in userChrome.css below @namespace seems to remove the links that appear in the overview.

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    .urlbar-textbox-container {color: inherit !important;}
    .urlbar-textbox-container-children {opacity: 1 !important;}
    .urlbar-over-link-box {opacity: 0 !important;}
    

    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files

  • How to write a SQL to get this information from the DD?

    Hi, I have a requirement like this:

    (1) we have a pattern with 100s of synonyms in the tables and views in the other 2 diagrams.

    (2) 100 francs of paintings have CASE_ID + SEQ_NUM as primary key.

    (3) SOME TABLES might have only CASE_ID as primary key.

    (4) several dozen paintings have CASE_ID + a few other columns as a PRIMARY KEY.

    I need a list of all the tables, the primary key is composed of (case_id + case_seq).

    Problem with my method is, when I got out, I also have tables that the primary key column CASE_ID.

    I don't need the paintings, including PK are EXACTLY CASE_ID + SEQ_NUM.

    user12240205 wrote:

    I need a list of all the tables, the primary key is composed of (case_id + case_seq).

    SELECT c.owner,

    c.table_name,

    c.constraint_name

    OF dba_constraints c,.

    dba_cons_columns cc

    WHERE c.constraint_type = 'P '.

    AND cc.owner = c.owner

    AND cc.table_name = c.table_name

    AND cc.constraint_name = c.constraint_name

    C.owner GROUP,

    c.table_name,

    c.constraint_name

    HAVING COUNT (*) = 2

    AND MIN (cc.column_name) = "CASE_ID".

    AND MAX (cc.column_name) = "SEQ_NUM.

    ORDER BY c.owner,

    c.table_name,

    c.constraint_name

    /

    SY.

  • Tecra R840-109 - alert HDD - unable to get disk information

    I turned on my Toshiba Tecra R840-109 and everything looks that the factory settings have been restored, but I still have my files on the hard disk in the users folder (where the system has also built a temporary user I'm connected now, I guess).

    At the opening, the computer asked me to do the things you do when you get a new computer (for example accept the license, install browsers, register fingerprints, if applicable etc.). In addition, it showed an error, alert HDD/SDD saying "Could not get the information from the disk, cannot use the alert function".

    Is there a way to solve this problem, that is, to apply the previous (original) user?

    An obvious solution would probably be to restore the system, but I don't have a backup set to the top (which I will fix as soon as this problem will be solved). Tried to reboot, nothing has changed.

    Information on the mobile phone: http://www.toshiba.co.il/en/disconti...ecra-r840-109/

    Any help is appreciated!

    Hello

    To be honest situation described sounds pretty confusing and not logical for me.
    If you do not have recovery (DVD or USB) media create using preinstalled Toshiba recovery media creator tool.
    After this use this bootable media and reinstalling the recovery image so you will have 'presets' again. After the installation of clean operating system, it is not possible to have the old data stored on the HARD drive, not on the C partition.
    The fact is that before the installation of recovery begins any HARD drive will be deleted and formatted.

    Sorry if I got you. If you have any concrete and clear questions do not hesitate to ask.

  • How to read information from the smart phone

    Hello

    I want to get the information from the BB Phone, as the OS version, model munber, IMEI and so on.

    can someone help me?

    Thank you

    String imei = GPRSInfo.imeiToString (GPRSInfo.getIMEI (), false);

    String deviceId = DeviceInfo.getDeviceId)
    String deviceName = DeviceInfo.getDeviceName)
    Soft string = DeviceInfo.getSoftwareVersion ();

  • Firefox Help my firefox top bar has been changed, I used to be able to get the file to bookmarks Format printed, and other services that I have found useful when you take information from the internet, where they went, I want them back?

    Firefox help

       Search
    

    "Found 0 results for" my firefox top bar has been changed, I used to be able to get the bookmarks printed Format file, and other services that I have found useful when taking information from the internet, I found bookmarks to the right of the new game to the top, but it seems not instantly friendly where they went, I want that they come back? »

    See:

  • I get a deactivation notice on Lightroom 6 having been transferred all the information from my old mac again I. Dude I have Mac's wiped and so off Lightroom. I also use Lightroom 6 on a Mac book air. What should I do?

    I get a deactivation notice on Lightroom 6 having been transferred all the information from my old mac again I. Dude I have Mac's wiped and so off Lightroom. I also use Lightroom 6 on a Mac book air. What should I do?

    Hi mbaye,.

    I rectified the issue of licensing. You should now be able to activate.

    Please confirm when done.

    Kind regards

    Assani

Maybe you are looking for