Retrieving values from XML in Oracle 9i - part II

Hello

regarding my previous post retrieving values of XML in Oracle 9i , I now have a different requirement.

Assuming that the XML is as follows:

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

" < GenericRequest xmlns =" http://webservices.mysite.com/test "xmlns:ns =" " http://webservices.mysite.com/test/NS "xmlns:ns1 =" " http://webservices.mysite.com/test/ns1 "xmlns:ns2 =" " http://webservices.mysite.com/test/ns2 ">

< ns1:order >

< ns1:orderItems >

< ns1:orderItem >

create < ns1:operation > < / ns1:operation >

< ns1:brickId > TST002 < / ns1:brickId >

< ns1:brickAttributes >

< ns1:attribute >

< ns2:name > COUNTRY < / ns2:name >

< ns2: value > U.S. < / ns2: value >

< / ns1:attribute >

< ns1:attribute >

< ns2:name > CUST_ID < / ns2:name >

< ns2: value > 12345 < / ns2: value >

< / ns1:attribute >

< ns1:attribute >

< ns2:name > CITY < / ns2:name >

< ns2: value > New York < / ns2: value >

< / ns1:attribute >

< / ns1:brickAttributes >

< / ns1:orderItem >

< ns1:orderItem >

Update < ns1:operation > < / ns1:operation >

< ns1:brickId > TST001 < / ns1:brickId >

< ns1:brickAttributes >

< ns1:attribute >

< ns2:name > COUNTRY < / ns2:name >

< ns2: value > U.S. < / ns2: value >

< / ns1:attribute >

< ns1:attribute >

< ns2:name > CUST_ID < / ns2:name >

< ns2: value > 22222 < / ns2: value >

< / ns1:attribute >

< ns1:attribute >

< ns2:name > CITY < / ns2:name >

< ns2: value > Los Angeles < / ns2: value >

< / ns1:attribute >

< / ns1:brickAttributes >

< / ns1:orderItem >

< / ns1:orderItems >

< / ns1:order >

< / GenericRequest >

As you can now see the XML contains several elements of the order. For each agenda item, I have a single operation and a brick_id. Then, for each item on the agenda, I have a list of brickAttributes (name and value).

How can I get something like that?

OPERATION BRICK_ID NAME VALUE

--------- -------- ------- -----------

create TST002 COUNTRY WE

create TST002 CUST_ID 12345

create TST002 New York CITY

update of TST001 COUNTRY United States

Update TST001 CUST_ID 22222

Update TST001 CITY Los Angeles

Version of database is 9.2.0.8

SELECT * FROM version of v$.

BANNER

----------------------------------------------------------------

Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production

PL/SQL Release 9.2.0.8.0 - Production

CORE Production 9.2.0.8.0

AMT for HP - UX: 9.2.0.8.0 - Production Version

NLSRTL Version 9.2.0.8.0 - Production

Kind regards.

Alberto

Response of Odie, result is that extend

with sample_data as (
select xmltype(
'

          
            
              
                create
                TST002
                
                  
                    COUNTRY
                    US
                  
                  
                    CUST_ID
                    12345
                  
                  
                    CITY
                    New York
                  
                
              
              
                update
                TST001
                
                  
                    COUNTRY
                    US
                  
                  
                    CUST_ID
                    22222
                  
                  
                    CITY
                    Los Angeles
                  
                
              
            
          
') xmldoc
from dual
)
select extractvalue(value(x), 'ns1:orderItem/ns1:operation', 'xmlns:ns1="http://webservices.mysite.com/test/ns1"') as operation
     , extractvalue(value(x), 'ns1:orderItem/ns1:brickId', 'xmlns:ns1="http://webservices.mysite.com/test/ns1"') as brick_id
     , extractvalue(value(y), 'ns1:attribute/ns2:name', 'xmlns:ns1="http://webservices.mysite.com/test/ns1", xmlns:ns2="http://webservices.mysite.com/test/ns2"') as name
     , extractvalue(value(y), 'ns1:attribute/ns2:value', 'xmlns:ns1="http://webservices.mysite.com/test/ns1", xmlns:ns2="http://webservices.mysite.com/test/ns2"') as value
from sample_data t
   , table(
       xmlsequence(
         extract(
           t.xmldoc
         , '/GenericRequest/ns1:order/ns1:orderItems/ns1:orderItem'
         , 'xmlns="http://webservices.mysite.com/test", xmlns:ns1="http://webservices.mysite.com/test/ns1"'
         )
       )
     ) x
   , table(
       xmlsequence(
         extract(
           value(x)
         , 'ns1:orderItem/ns1:brickAttributes/ns1:attribute'
         , 'xmlns:ns1="http://webservices.mysite.com/test/ns1"'
         )
       )
     ) y
;

As shown, it simply retrieves to a higher level object that repeats once in table x and happening at the table there, which returns the expandable nodes.  The join is managed by value (x) in the second simple table.  It assumes that there is always 1 or several nodes of ns1:attribute in each ns1:orderItem.

Tags: Database

Similar Questions

  • Retrieving values from XML in Oracle 9i

    Hello

    I have the following XML:

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

    " < GenericRequest xmlns =" http://webservices.mysite.com/test "xmlns:ns =" " http://webservices.mysite.com/test "xmlns:ns1 =" " http://webservices.mysite.com/test "xmlns:ns2 =" " http://webservices.mysite.com/test ">

    < ns1:order >

    < ns1:orderItems >

    < ns1:orderItem >

    create < ns1:operation > < / ns1:operation >

    < ns1:brickId > TST123 < / ns1:brickId >

    < ns1:brickAttributes >

    < ns1:attribute >

    < ns2:name > COUNTRY < / ns2:name >

    < ns2: value > U.S. < / ns2: value >

    < / ns1:attribute >

    < ns1:attribute >

    < ns2:name > CUST_ID < / ns2:name >

    < ns2: value > 12345 < / ns2: value >

    < / ns1:attribute >

    < ns1:attribute >

    < ns2:name > CITY < / ns2:name >

    < ns2: value > New York < / ns2: value >

    < / ns1:attribute >

    < / ns1:brickAttributes >

    < / ns1:orderItem >

    < / ns1:orderItems >

    < / ns1:order >

    < / GenericRequest >

    And I use an older version of Oracle (it's something I can't change unfortunately):

    SELECT * FROM version of v$.

    BANNER

    ----------------------------------------------------------------

    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production

    PL/SQL Release 9.2.0.8.0 - Production
    CORE Production 9.2.0.8.0
    AMT for HP - UX: 9.2.0.8.0 - Production Version
    NLSRTL Version 9.2.0.8.0 - Production

    What is the best way to get the list name / value in a format like this with a SQL query?

    VALUE NAME

    ------- --------

    COUNTRIES WE

    CUST_ID 12345

    New York CITY

    Kind regards.

    Alberto

    Hello Alberto,.

    You can do it like this:

    with sample_data as)

    Select xmltype)

    '

    "http://WebServices.mysite.com/test" xmlns:ns ="http://webservices.mysite.com/test" xmlns:ns1 ="http://webservices.mysite.com/test" xmlns:ns2 = "http://webservices.mysite.com/test" >. "

    create

    TST123

    COUNTRY

    WE

    CUST_ID

    12345

    CITY

    New York City

    xmlDoc ')

    of the double

    )

    Select extractvalue (value (x), ' / ns1:attribute / ns2:name ',' xmlns:ns1 is "http://webservices.mysite.com/test", xmlns:ns2 ="http://webservices.mysite.com/test" "" ") as the name

    ExtractValue (value (x), ' / ns1:attribute / ns2: value ',' xmlns:ns1 = "http://webservices.mysite.com/test", xmlns:ns2 ="http://webservices.mysite.com/test" "" ") as the value

    of sample_data t

    table)

    xmlsequence)

    extract)

    t.xmlDoc

    , ' / GenericRequest / ns1:order / ns1:orderItems / ns1:orderItem / ns1:brickAttributes / ns1:attribute'

    ", ' xmlns ="http://webservices.mysite.com/test", xmlns:ns1 ="http://webservices.mysite.com/test"". "

    )

    )

    ) x

    ;

    Namespace URI appear to be the same in your example of XML, if this is really the case, you can simplify the query and use the same namespace by default in any of the query.

  • Retrieving values from XML

    Hi all
    I don't know how to extract the POLICY of XML value which is 25000.
    Here's what I got tired.

    SELECT extractvalue (COLUMN_VALUE, ' / Member/MemberId ') MemberID,.
    ExtractValue (' COLUMN_VALUE, ' / Member/membership/MembershipKey/Key / * ') PolicyID
    TABLE (XMLSequence (xmltype (')))
    < member >
    MRD000200 < MemberId > < / MemberId >
    < 00 > BenefitRecordId < / BenefitRecordId >
    < membership >
    < MembershipKey >
    < issuer > CBA < / transmitter >
    < key name = "ABC_DIVISIONS" Id = "A_5" / >
    < / MembershipKey >
    < MembershipKey >
    < issuer > CBA < / transmitter >
    < key name = 'POLICY' Id = "25000" / >
    < / MembershipKey >
    < MembershipKey >
    < issuer > CBA < / transmitter >
    < key name = "SECTION" Id = "E22" / >
    < / MembershipKey >
    < / membership >
    < / member >
    '
    () .extract ('/member')));

    I want the rest of output
    Member ID PolicyID SECTION
    MRD000200 25000 E22

    Please suggest.
    Thank you.

    One way is like this:

    SELECT extractvalue(COLUMN_VALUE, '/Member/MemberId') MemberID,
    extractvalue (COLUMN_VALUE, '/Member/Membership/MembershipKey/Key[@Name="POLICY"]/@Id') PolicyID,
    extractvalue (COLUMN_VALUE, '/Member/Membership/MembershipKey/Key[@Name="SECTION"]/@Id') SectionID
    FROM TABLE(XMLSequence(xmltype('
    
    MRD000200
    00
    
    
    ABC
    
    
    
    ABC
    
    
    
    ABC
    
    
    
    
    '
    ).extract('/Member')));
    
  • retrieve value from XML

    Hello
    I have an XML doc string stored in a varchar2 column, I want to use Oracle's XML functionality to the query string after the converted to an XMLTYPE.

    I tried to convert and questioning, but it was in vain.

    Please give me ideas or links to

    1 convert an xml stored in VARCHAR2 to XML doc.
    2. tell me the API for questioning against the created XML doc.

    Kind regards
    Kone

    We can give you ideas without a version number (3 digits).

    We can not tell you why what you were doing was not working if you don't show it to us.

    Start there.

  • to retrieve data from xml data type

    Hello...
    I have a doubt in the oracle database... Here's how to retrieve data from xml data type?

    Like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2  
    3 4 toMonth5 5 ctTestPan1 6 costType2 7 toYear2012 8 fromMonth12 9 fromYear2011 10 11
    ') as xml from dual) 12 -- 13 -- end of sample XMLDATA, use below query on your own table etc. as required 14 -- 15 select x.* 16 from t 17 ,xmltable('/DETAILS/FIELDS_VALUES/FIELD' 18 passing t.xml 19 columns name varchar2(30) path './NAME' 20 ,val varchar2(10) path './VALUE' 21* ) x SQL> / NAME VAL ------------------------------ ---------- toMonth 5 ctTestPan 1 costType 2 toYear 2012 fromMonth 12 fromYear 2011 6 rows selected.
  • Retrieve data from xml file

    Hello

    Consider, having more xml file

    
        

    How can I retrieve the value of the key to lonlat "36.76,3.05."

    in my qml file, I had something like

    ...
            Page {
                id: ch_loc
                Container {
    
                    //background: Color.White
                    ListView {
                        dataModel: XmlDataModel {
                            source: "LonLat.xml"
                        }
                        listItemComponents: [
                            ListItemComponent {
                            }
                        ]
                        onTriggered: {
                            //qDebug(indexPath[3]);
                            app.initiateRequest(dataModel.data(indexPath[0]))
                        }
                    }
                }
            }
    ...
    

    I'm on the right track? Need help please.

    Thank you, best regards.

    Maddin

    Hello

    OK after some reading, I thought about it.

    What I did:

    Page {
                id: ch_loc
                Container {
    
                    //background: Color.White
                    ListView {
                        dataModel: XmlDataModel {
                            source: "LonLat.xml"
                        }
                        listItemComponents: [
                            ListItemComponent {
                            }
                        ]
                        onTriggered: {
                            var selectedItem = dataModel.data(indexPath);
                            app.initiateRequest(selectedItem.value);
                        }
                    }
                }
            }
    

    Please don't quite understand. IAM does not ask for help without doing anything by myself. IAM at this new and iam from difficult to understand the whole material. For now iam happy that I understood this part.

    If this is done for me.

    Concerning

    Maddin

  • SQL statement to retrieve value from the attribute using XPATH

    Hi all

    I think this is the right place to post this request since it is related to oracle and xpath.

    I'm writing a sql statement of xpath that will extract the value of the column attribute is what type of clob data. Here is the xml example (xml_content is the column name)



    < RAFSCREEN >
    < Home >
    < clientnumber reference = "123123" >
    < / servant >
    < RAFSCREEN >



    I need to output query should return 123123.
    I'm using query

    Select extract (xmltype (xml_content), 'RAFSCREEN, Domestic, @clientnumber') as clientnumber from table_name

    It will be very useful if someone answer this question.
    Thank you

    It is Possible...

    10g> with form_content
      2  as
      3  (
      4  select 212 form_content_id , '    ' xml_content from dual union all
      5  select 222 , '    '   from dual union all
      6  select 223 , '    '   from dual union all
      7  select 224 , '    '   from dual )
      8  select form_content_id, extractValue(xmltype(xml_content),'/RAF/XBorderRAF/ReviewReferences/@clientLegalName') as clientnumber
      9  from form_content ;
    
    FORM_CONTENT_ID CLIENTNUMBER
    --------------- --------------------------------------------------------------------------------------------------------------------------------------------
    212      ABC123
    222      ZY123
    223      IN123
    224      NL123
    
    4 rows selected.
    

    Your request (you need)

    select form_content_id, extractValue(xmltype(xml_content),'/RAF/XBorderRAF/ReviewReferences/@clientLegalName') as clientnumber
    from form_content ;
    
  • How repeat/option output values from XML in the CLOB column?

    Environment:


    Oracle 11.2.0.3 EE on Solaris


    Very much a newbie XML but try.  :-)


    I have a table with the XML stored in a CLOB (no, I can't imagine the environment but I live here).


    I need to display the data in a flat file format.  Some of the data is both optional and possibly repeat if present.


    Here's a fun sample data:


    "< res: customers xmlns: res = ' http://www.whatever.com/response ">

    < res: lastName > SMITH < / res: lastName >

    < res: firstName > JENNIFER < / res: name >

    < res: Extras >

    < res: Extra >

    HOME < res: phoneType > < / res: phoneType >

    555-555-5555 < res: phoneNumber > < / res: phoneNumber >

    < / res: Extra >

    < res: Extra >

    < res: phoneType > MOBILE < / res: phoneType >

    666-666-6666 < res: phoneNumber > < / res: phoneNumber >

    < / res: Extra >

    < / res: Extras >

    < res: lastName > JONES < / res: name >

    < res: firstName > ROBERT < / res: name >

    < res: Extras >

    < res: Extra >

    HOME < res: phoneType > < / res: / phoneType >

    123-456-7890 < res: phoneNumber > < / res: phoneNumber >

    < / res: Extra >

    < / res: Extras >

    < res: lastName > MURPHY < / res: lastName >

    < res: firstName > SEAN < / res: name >

    < / res: customers >

    I'm trying to get my output to look like this:


    Last name first name model number

    ------------- -------------- -------- ---------------

    JENNIFER SMITH 555-555-5555 HOME

    SMITH JENNIFER MOBILE 666-666-6666

    HOME OF ROBERT JONES 123-456-7890

    SEAN MURPHY


    I don't know how to get the repeated lines printed and I don't know how to get the printed line that does not contain the optional data.


    Here is the script that I have developed so far.  With my actual data I can get the printed name and I can get phone information printed out but only to the exclusion of the names. I was unable to get the data if the optional data is not present.


    I tried to refer to information from phone and then back up to 2 levels for the information of name but I receive: ORA-19110: no support for XQuery expression


    Select x.*

    client m.

    XMLTable (XMLNamespaces ('http://www.whatever.com/response' as "res") )

    , ' / res: clients/res: res/Extras: Extra '

    by the way of xmltype (m.CUSTOMER_XML)

    columns

    lastName varchar2 (80) WAY '... /... / res: LastName'

    , name varchar2 (30) WAY '... /... /FirstName'

    , varchar2 (30) phoneType PATH '.'

    , number of phone varchar2 (30) PATH '.'

    ) x

    Any help is greatly appreciated.


    -gary

    Hi Gary,.

    Are you sure the sample XML code correspond to your actual data?

    The second query expected error because the PATH expression refers to multiple targets.

    If it's really like that, the XML structure is not very easy to deal with. It would be wise to have a container element enclosing each customer information, like this:

    http://www.whatever.com/response">

    SMITH

    JENNIFER

    HOME

    555-555-5555.

    MOBILE

    666-666-6666.

    ...

    To answer your main question, you can use an OUTER JOIN to include data that do not have Extras.

    Using your original sample XML, something like this works for me:

    SQL > select x.lastName

    2, x.firstName

    3, y.phoneType

    4, y.phoneNumber

    client 5 m

    6, XMLTable)

    7 XMLNamespaces (default 'http://www.whatever.com/response')

    8, ' for $i in/clients/first name

    9 return element {} r

    $i 10 / following - sibling:Extras [1]

    11, $i/next - sibling:firstName [1]

    12          , $i

    13          }'

    14 passage xmltype (m.CUSTOMER_XML)

    15 columns

    lastName 16 varchar2 (80) PATH "lastName."

    17, firstName varchar2 (30) PATH "first name".

    18, extras xmltype PATH "Extras."

    (19) x

    20, XMLTable)

    21 XMLNamespaces (default 'http://www.whatever.com/response')

    22, ' / extras/Extra.

    23 passage x.extras

    24 columns

    VARCHAR2 (30) 25 phoneType PATH "phoneType".

    26, phoneNumber varchar2 (30) PATH "phone".

    27       ) (+) y

    28;

    LASTNAME FIRSTNAME PHONETYPE PHONENUMBER

    ------------ ----------- ----------- --------------

    JENNIFER SMITH 555-555-5555 HOME

    SMITH JENNIFER MOBILE 666-666-6666

    HOME OF ROBERT JONES 123-456-7890

    SEAN MURPHY

  • Retrieve data from xml to text-column

    I have a table that has a field (data type 'text') that contains an xml file. After some trial and error, I discovered that the only way to extract the full XML of this table is to use the ms sql "for XML" clause. But my problem is, that the column containing the xml file is called something like "XML_F52E2B61 - 18A 1 - 11 d 1-B105-00805F49916B" which is an identifier of invalids by CF.

    Is there a way to access this column by id instead of its name or what is the best way to access this topic?

    The SQL I use is:

    SELECT XmlPackage
    FROM LogK3OnChange
    WHERE DealerID = IsNull(<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.dealerid#">, DealerID)
    AND LogID = <cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.logid#">
    FOR XML RAW

    Kind regards

    Heiko

    I have it!

    If I use something like

    #myQuery ["XML_F52E2B61 - 18A 1 - 11 d 1-B105-00805F49916B"] [1] #.

    I can access the column without any problem

  • Need assistance to migrate data from XML to oracle table.

    Hey Odie,

    Im trying to insert data from an xml file into a table.

    My XML file is as follows.

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

    - < TransferXML >

    < BatchName > HJ69240 < / BatchName >

    < BatchStatus > Park < / BatchStatus >

    - < SubBatch >

    < SubBatchName > UQ80288 < / SubBatchName >

    < SubBatchStatus > project < / SubBatchStatus >

    - < SubBatchDetail >

    < Ingredient > I3308 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 4.0 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3261 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 3.5 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3235 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 0,5 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3142 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 0,2 < / MDispensedQty >

    < / SubBatchDetail >

    </SubBatch>

    - < SubBatch >

    < SubBatchName > ZB97913 < / SubBatchName >

    < SubBatchStatus > incomplete < / SubBatchStatus >

    - < SubBatchDetail >

    < Ingredient > I3309 < / > of theingredient

    < DispensedQty > 0,75 < / DispensedQty >

    < MDispensedQty > 0,0 < / MDispensedQty >

    < / SubBatchDetail >

    - < SubBatchDetail >

    < Ingredient > I3436 < / > of theingredient

    < DispensedQty > 0,0 < / DispensedQty >

    < MDispensedQty > 0,05 < / MDispensedQty >

    < / SubBatchDetail >

    </SubBatch>

    <Final>false</Final>

    < / TransferXML >



    With the help of your previous posts I've migrated data from this xml file in a table that works perfectly well. But these data repeats instead of giving 6 lines that his return 12 lines guide please.


    CREATE TABLE XXBATCH AS

    SELECT A.BatchName, A.BatchStatus, B.SubBatchName, B.SubBatchStatus, C.Ingredient, C.DispensedQty, C.MDispensedQty, A.FINAL

    OF (XMLTable ('/ TransferXML'))

    from xmltype)

    BFILENAME('APPS_DATA_FILE_DIR','HJ69240.) XML')

    nls_charset_id ('AL32UTF8')

    ) COLUMNS

    BatchName VARCHAR2 path (99) "BatchName.

    , Path of the BatchStatus VARCHAR2 (999) "BatchStatus.

    Path VARCHAR2 (99) final 'Final')),

    (XMLTable ('/ TransferXML/SubBatch '))

    from xmltype)

    BFILENAME('APPS_DATA_FILE_DIR','HJ69240.) XML')

    nls_charset_id ('AL32UTF8')

    ) COLUMNS

    Path of SubBatchName VARCHAR2 (99) "SubBatch/SubBatchName".

    , Path of the SubBatchStatus VARCHAR2 (99) "SubBatch/SubBatchStatus".

    (B)

    (XMLTable ('/ TransferXML/SubBatch/SubBatchDetail '))

    from xmltype)

    BFILENAME('APPS_DATA_FILE_DIR','HJ69240.) XML')

    nls_charset_id ('AL32UTF8')

    ) COLUMNS

    Path of the ingredient VARCHAR2 (99) SubBatchDetail/ingredient"."

    , Path of the DispensedQty VARCHAR2 (99) "SubBatchDetail/DispensedQty".

    , Path of the MDispensedQty VARCHAR2 (99) "SubBatchDetail/MDispensedQty".

    (C)

    I didn't test your query, but apparently it's because you have access to the same file three times instead of spend one XMLTable to another correlated nested groups.

    Better, this should work:

    SELECT A.BatchName

    A.BatchStatus

    B.SubBatchName

    B.SubBatchStatus

    C.Ingredient

    C.DispensedQty

    C.MDispensedQty

    A.FINAL

    FROM XMLTable ('/ TransferXML')

    PASSAGE xmltype (bfilename('TEST_DIR','HJ69240.xml'), nls_charset_id ('AL32UTF8'))

    Path of COLUMNS BatchName VARCHAR2 (99) "BatchName.

    , Path of the BatchStatus VARCHAR2 (999) "BatchStatus.

    , Path VARCHAR2 (99) final "Final."

    , Path of XMLTYPE «SubBatch» SubBatchList

    ) AT

    , XMLTable ('/ SubBatch')

    PASSAGE SubBatchList

    Path of COLUMNS SubBatchName VARCHAR2 (99) "SubBatchName".

    , Path of the SubBatchStatus VARCHAR2 (99) "SubBatchStatus".

    , Path of XMLTYPE «SubBatchDetail» SubBatchDetailList

    ) B

    , XMLTable ('/ SubBatchDetail')

    PASSAGE SubBatchDetailList

    Path VARCHAR2 (99) ingredient of COLUMNS "Ingredient."

    , Path of the DispensedQty VARCHAR2 (99) "DispensedQty".

    , Path of the MDispensedQty VARCHAR2 (99) "MDispensedQty".

    ) C

    ;

    Post edited by: odie_63

  • Retrieving values from comma delimited string from PL/SQL procedure

    Gurus,

    I would spend that time but I'm crunched for time. I have a value of varchar2 parameter delimited by commas that will take X number of delimited values.

    Can you guys recommend a simple method to extract these values so that I can use this in explicit cursor?

    I give points to useful and correct responses.


    Thanks again,
    Scott


    BTW, I use Oracle 10 g and 11i applications

    Published by: sreese on January 31, 2012 15:37

    Hello

    Check out these pages:
    http://www.Oracle-base.com/articles/Misc/DynamicInLists.php
    http://tkyte.blogspot.com/2006/06/varying-in-lists.html

  • passing values from unix to oracle

    Hello

    I need to pass a variable in unix to oracle as an argument

    I use oracle 9i and HP - UNIX

    for ex, I need to run a sql on UNIX with different values as test.sql script 1, test.sql 2...

    I need to pass the values (1, 2.etc) to sql script shell script.

    It's very urgent. could you please provide an example of script for this.

    URGENT?  :|

    Unix>  sqlplus user/pass@db @script.sql $1 $2 $3
    #---where $1 $2 $3 are unix variables 
    
    Unix> sqlplus user/pass@db @script.sql 1 2 3
    #---where 1 2 3 are literal values 
    

    SS

  • Import/insert data from XML in Oracle database tables?

    Hello. (I use 10.1.3.3.0 JDeveloper and Oracle 10 g)

    I was able to export the data of one of my tables in the database using a View object and .writeXML.

    Now, I want to take an xml file that is formatted just like what is spit out by the writeXML and put this info in my database table. I followed the examples online, and have tried to use .readXML as follows:

    Element = XMLDoc.getDocumentElement ();

    vo.readXML (element,-1);

    I know that it's the kind of work, because at first, I got an error message that one of the required attributes was missing. So, I added this attribute in my xml file and run my code. No errors. But, I checked my database, and new records have been added.

    Is there something I did wrong? Or is it maybe something I left out? I also noticed that there are several versions of readXML as readFromXML. Which should I use and how?

    Thank you.

    Hello

    Example of work is completely: http://kuba.zilp.pl/?id=461

    Kuba

  • Retrieves the values of XML based on filters

    I am new to use XML with oracle. This is a sample XML from an XML file, now the question is it really possible to write sql queries to extract based on a result, that is to say, if I do a clip like this extract(column_name,//Requests//RequestBody//Item//ItemHeader//ItemAction/text(),).getStringVal () then I results XL1XL2 what I need exactly is only "ItemAction" XML member value when the value is = 'Add '. which means that the final result value, I need XL1. Please note that the values I gave ablove XL1 and XL2, is flexible, that is, sometimes, it's XLLL1 some time XL1, so can't go based on the use of SUBSTR function to extract a fixed value.

    < ns3:Requests >

    < ns3:Request >

    < ns3:RequestBody >

    < ns3:Item >

    < ns3:ItemHeader >

    < ns3:ItemId > 99 < / ns3:ItemId >

    < ns3:ItemType > TypItem < / ns3:ItemType >

    < ns3:ItemAction > Add < / ns3:ItemAction >

    < / ns3:ItemHeader >

    < ns3:ItemBody >

    < ns3:ServiceItem >

    < ns3:ServiceCode > XL1 < / ns3:ServiceCode >

    < / ns3:ServiceItem >

    < / ns3:ItemBody >

    < / ns3:Item >

    < ns3:Item >

    < ns3:ItemHeader >

    < ns3:ItemId > 100 < / ns3:ItemId >

    < ns3:ItemType > TypItem < / ns3:ItemType >

    < ns3:ItemAction > Remove < / ns3:ItemAction >

    < / ns3:ItemHeader >

    < ns3:ItemBody >

    < ns3:ServiceItem >

    < ns3:ServiceCode > XL2 < / ns3:ServiceCode >

    < / ns3:ServiceItem >

    < / ns3:ItemBody >

    < / ns3:Item >

    < / ns3:RequestBody >

    < / ns3:Request >

    < / ns3:Requests >

    As I understand it, you want to return the code of service elements where the ItemHeader = "add"?  Note: You have missed your name space in the XML document, so I added a.

    with data (the_xml) as)

    Select xmltype (')

    99

    TypItem

    Add

    XL1

    100

    TypItem

    Delete

    XL2

    ')

    of the double

    )

    Select x.*

    data d

    Join the xmltable (xmlnamespaces ('somenamespace "like" ns3 "),)

    "' ns3:Requests / ns3:Request / / ns3:RequestBody / / ns3:Item [ns3:ItemHeader / ns3:ItemAction ="Add"]"

    in passing d.the_xml

    columns

    Path of varchar2 (20) conduitePlan ' ns3:ItemBody / ns3:ServiceItem / ns3:ServiceCode'

    ) x 1 = 1

    RESULT

    CONDUITEPLAN

    'XL1 '.

  • Passing values from a CO of a page in the xml file of a field with LOV.

    Hello

    I have 2 pages in this CUSTOMIZATION and the 2nd page got fields that have their turn to LOV.

    The query behind the LOV is sitting in the XML file and as an amendment to this motion, he needs some dynamic values

    I got to a stage where in the Commander of the 2nd page I set up values using getparameters.

    But how to pass this value from the 2nd page to the XML FILE.

    Thank you

    Regis

    Hi Regis

    Leave; s first focus on your first build errors. You said very well reconstruction work but compilation error comes when you run the page.

    It's strange. Can you please confirm if you have added the OFA libraries to your project. Ideally, they should be there once you create an OA project

    Concerning

    Marie Lise S

Maybe you are looking for