Add to the XMLTYPE column

Hello

I have a requirement to insert a new XML tag in the existing XMLTYPE column.

Oracle version: Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

create table rds_xml_config (module_name varchar2 (32), module_type varchar2 (100), config_xml xmltype);

insert into rds_xml_config values ('TRANSMIT_SEQ', 'INTERFACE',' < transmit_seq > <!-file sequence number will be updated after each race-> < file = "RTP" Type_de_fichier > < file_seq_num > 2457 < / file_seq_num > < / file > < file Type_de_fichier = 'RTS' > < file_seq_num > 2453 < / file_seq_num > < / file > < Type_de_fichier = "RTL" file > < file_seq_num >) 2522 < / file_seq_num > < / file > < / transmit_seq > ');

I have to add < file = "RTX" Type_de_fichier > < file_seq_num > 0 < / file_seq_num > < / file >.

As a temporary work around, I used below the update statement.

Update rds_xml_config

Set config_xml =' < transmit_seq > <!-file sequence number will be updated after each race-> < file = "RTP" Type_de_fichier > < file_seq_num > 2457 < / file_seq_num > < / file > < file Type_de_fichier = 'RTS' > < file_seq_num > 2453 < / file_seq_num > < / file > < Type_de_fichier = "RTL" file > < file_seq_num > 2522 < / file_seq_num > < / file > < file = "RTX" file_type > < file_seq_num > 0 < / file_seq_num > < / file > < / transmit_seq > '

WHERE module_type = "INTERFACE".

AND module_name = "TRANSMIT_SEQ";

SEQ numbers will be modified for each race of the file, so I cannot use the work temporary around during migration to production, have we a way to add new XMLtag.

Thank you

Rambeau

Search in INSERTCHILDXML

http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions066.htm

SQL> select a.config_xml.extract('*') old_xml
  2       , insertchildxml(config_xml, '/transmit_seq', 'file',xmltype('10000')).extract('*') new_xml
  3    from rds_xml_config a;

OLD_XML                                                                                              NEW_XML
---------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
                                                                                       
                                             
                                                                                 
    2457                                                                 2457
                                                                                                
                                                                                 
    2453                                                                 2453
                                                                                                
                                                                                 
    2522                                                                 2522
                                                                                                
                                                                                        
                                                                                                         10000
                                                                                                       
                                                                                                     

Tags: Database

Similar Questions

  • The xmltype column search and listing content in relational format

    Hi all

    I have a database of GR 11, 1 subject table containing the xmltype column. I'm writing a query that displays conetents xml in a relational format.
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Jan 17 11:45:06 2013
    
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Release 11.1.0.7.0 - 64bit Production
    SQL > select * from v version $;

    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11 g Release 11.1.0.7.0 - 64 bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE Production 11.1.0.7.0
    AMT for 64-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production

    SQL > BULKMESSAGES Desc;
    Name of Type Null
    --------------- ---- -------------
    TRANSFER_ID VARCHAR2 (100)
    TRANSFER_LOGS XMLTYPE()
    TRANSFER_RESULT VARCHAR2 (10)

    SQL > select * from BULKMESSAGES
    where TRANSFER_RESULT = "REFUSED."
    /
    TRANSFER_ID TRANSFER_LOGS TRANSFER_RESULT
    ---------------- ---------------------------------------------------------------- ---------------
    T3217 < env:Envelope xmlns:env = 'http://www.w3.org/2003/05/soap-envelope' > REJECTED



    Column of xmltype TRNASFER_LOGS stores the SOAP responses. Response SOAP sample (dummied) of the TRANSFER_LOGS xml column is below:
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
         <env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"/>
         <env:Body xmlns:env="http://www.w3.org/2003/05/soap-envelope">
              <env:Fault xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                   <env:Code xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                        <env:Value xmlns:env="http://www.w3.org/2003/05/soap-envelope">env:Receiver</env:Value>
                        <env:Subcode xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                             <env:Value xmlns:fault="http://www.es.com/soapfaults" xmlns:env="http://www.w3.org/2003/05/soap-envelope">fault:MessageBlocked</env:Value>
                        </env:Subcode>
                   </env:Code>
                   <env:Reason xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                        <env:Text lang="en" xmlns:env="http://www.w3.org/2003/05/soap-envelope">connection rejected</env:Text>
                   </env:Reason>
                   <env:Detail xmlns:fault="http://www.es.com/soapfaults" fault:type="faultDetails" fault:messageId="0000013a6" xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                        <fault:path policy="Request Message">
                             <fault:filter status="Fail" name="Call 'Process request '">
                                  <fault:path policy="Process xml ">
                                       <fault:filter status="Fail" name="Call 'Call 3rdparty service'">
                                            <fault:path policy="Call external service">
                                                 <fault:filter status="Pass" name="Extract message"/>
                                            </fault:path>
                                       </fault:filter>
                                  </fault:path>
                             </fault:filter>
                        </fault:path>
                        <fault:attributes>
                             <fault:attribute name="monitoring.enabled" value="true"/>
                             <fault:attribute name="requestor" value="none"/>
                             <fault:attribute name="circuit.failure.reason" value="connection rejected"/>
                             <fault:attribute name="message_protocol" value="SOAP"/>
                             <fault:attribute name="user_id" value="31274556"/>
                             <fault:attribute name="ws_name" value="PUSHDOC"/>
                             <fault:attribute name="user.enabled" value="N"/>
                             <fault:attribute name="http.request.clientaddr" value="/10.254.123.44:43840"/>
                             <fault:attribute name="soap_action" value="pushDocument"/>
                             <fault:attribute name="message.reception_time" value="1349769769742"/>
                             <fault:attribute name="user.api_logging_flag" value="Y"/>
                             <fault:attribute name="circuit.exception" value="com.es.circuit.CircuitAbortException: connection rejected"/>
                             <fault:attribute name="end_point" value="https://es.live.com/pdfs"/>
                             <fault:attribute name="message.protocol.type" value="http"/>
                             <fault:attribute name="user.incoming_date" value="09-11-2013 09:02:49"/>
                             <fault:attribute name="http.destination.host" value="es.live.com"/>
                             <fault:attribute name="message.local.address" value="/100.25.40.82:8085"/>
                             <fault:attribute value="N"/>
                        </fault:attributes>
                   </env:Detail>
              </env:Fault>
         </env:Body>
    </env:Envelope>
    My goal is to search for documents TRANSFER_LOGS for lines that contain flaws: attribute name = "circuit.exception". Then report "fault: name attribute" and their values in relational format. For example:
    TRANSFER_ID    TRANSFER_RESULT FAULT_FAIL_REASON    FAULT_CIRCUIT_EXCEPTION                               FAULT_WS_NAME   FAULT_DESTINATION_HOST
    ----------     --------------- ----------------     -------------------------------------------------------- -------------   ---------------------
    T3217          REJECTED       CONNECTION REJECTED  com.es.circuit.CircuitAbortException: connection rejected  PUSHDOC       es.live.com
    I am new to oracle XML sql querying. Documents in the column of xmltype TRANSFER_LOGS have many namespaces and the query I've tried does not work. So, any help or pointers to search and extract TRANSFER_LOGS in above format is greatly appreciated.

    Thanks in advance.

    VC

    Hello

    You can use something like this:

    SQL> select t.transfer_id, t.transfer_result, x.*
      2  from bulkmessages t
      3     , xmltable(
      4         xmlnamespaces(
      5           'http://www.w3.org/2003/05/soap-envelope' as "e"
      6         , 'http://www.es.com/soapfaults' as "f"
      7         )
      8       , '/e:Envelope/e:Body/e:Fault/e:Detail/f:attributes'
      9         passing t.transfer_logs
     10         columns
     11           FAULT_FAIL_REASON       varchar2(200) path 'f:attribute[@name="circuit.failure.reason"]/@value'
     12         , FAULT_CIRCUIT_EXCEPTION     varchar2(200) path 'f:attribute[@name="circuit.exception"]/@value'
     13         , FAULT_WS_NAME           varchar2(200) path 'f:attribute[@name="ws_name"]/@value'
     14         , FAULT_DESTINATION_HOST  varchar2(200) path 'f:attribute[@name="http.destination.host"]/@value'
     15         ) x
     16  where xmlexists(
     17         'declare namespace e = "http://www.w3.org/2003/05/soap-envelope"; (: :)
     18          declare namespace f = "http://www.es.com/soapfaults"; (: :)
     19          /e:Envelope/e:Body/e:Fault/e:Detail/f:attributes/f:attribute[@name="circuit.exception"]'
     20          passing t.transfer_logs
     21        ) ;
    
    TRANSFER_ID     TRANSFER_RESULT FAULT_FAIL_REASON        FAULT_CIRCUIT_EXCEPTION                                       FAULT_WS_NAME    FAULT_DESTINATION_HOST
    --------------- --------------- ------------------------ ------------------------------------------------------------- ---------------- -------------------------
    T3217           REJECTED        connection rejected      com.es.circuit.CircuitAbortException: connection rejected     PUSHDOC          es.live.com
     
    

    Or, more simply:

    SQL> select t.transfer_id, t.transfer_result, x.*
      2  from bulkmessages t
      3     , xmltable(
      4         xmlnamespaces(
      5           'http://www.w3.org/2003/05/soap-envelope' as "e"
      6         , 'http://www.es.com/soapfaults' as "f"
      7         )
      8       , '/e:Envelope/e:Body/e:Fault/e:Detail/f:attributes'
      9         passing t.transfer_logs
     10         columns
     11           FAULT_FAIL_REASON       varchar2(200) path 'f:attribute[@name="circuit.failure.reason"]/@value'
     12         , FAULT_CIRCUIT_EXCEPTION     varchar2(200) path 'f:attribute[@name="circuit.exception"]/@value'
     13         , FAULT_WS_NAME           varchar2(200) path 'f:attribute[@name="ws_name"]/@value'
     14         , FAULT_DESTINATION_HOST  varchar2(200) path 'f:attribute[@name="http.destination.host"]/@value'
     15         ) x
     16  where x.FAULT_CIRCUIT_EXCEPTION is not null ;
    
    TRANSFER_ID    TRANSFER_RESULT FAULT_FAIL_REASON      FAULT_CIRCUIT_EXCEPTION                                      FAULT_WS_NAME      FAULT_DESTINATION_HOST
    -------------- --------------- ---------------------- ------------------------------------------------------------ ------------------ --------------------------
    T3217          REJECTED        connection rejected    com.es.circuit.CircuitAbortException: connection rejected    PUSHDOC            es.live.com
      
    
  • ADF and the use of the XMLType columns

    After discovering the Jdeveloper 11 g was able to generate business components/data controls for complex web services (see this tutorial excellet http://www.oracle.com/technology/tech/fmw4apps/agile/pdf/adf11g-agile.pdf), I assumed that jdev 11 g should now have the same capacity on XMLtype columns with a registered scheme, and was therefore a good match for our enforcement objectives be able to edit
    parts of an XML document to aid in the face of components and Assembly/store the document in a way centic document in a relational/XML database XMLType column hybrid.

    I tested this point, has created a table with an XMLType column binary, saved the schema in database (11g) and jdev(11g) and generated my components.


    I was very disappointed at the discovery of the structure of data controls stops at the level of the attribute in the table (ie the XMLType column), so none of the structure of the XML document is revealed or can be used in a meaningful way through data control.

    Am I missing something here? should not control data generated reveal the XML structure and allow the use of components of forms/table faces on some parts of the structure of the document? I'm not a java programmer, so was really hoping to do this with data not generated controls beans not.

    If it is just to treat it as a CLOB, what's the point of registered xsd schemas?

    Yes, it is through java. Sorry

  • What is the default size of the XMLType column?

    I have a table with 1 type of crude and 1 XMLType column. In the XMLType column I'm inserting XML, more

    < ocaStatus xmlns = "http://xmlbeans.apache.org/ocastatus" >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2010 - 01 - 19 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > DocumentnotinNIMS < / comment >
    < / status >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2010 - 01 - 19 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > DocumentnotinNIMS < / comment >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 27 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 26 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 25 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < statusCode > 306 < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 04 - 21 < / statusDate >
    < user name > u0075970 < / userId >
    < / status >
    < status >
    < > 301 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 02 - 05 < / statusDate >
    < user name > DMS_WORKFLOW < / userId >
    < comment > < / comment >
    < / status >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2010 - 01 - 17 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > Comparedfornimsacf < / comment >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 09 - 16 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 29 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 28 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 27 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 26 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 25 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 22 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 21 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < > 501 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 08 - 20 < / statusDate >
    < user name > oca_scheduled_job < / userId >
    < / status >
    < status >
    < statusCode > 306 < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 04 - 21 < / statusDate >
    < user name > u0075970 < / userId >
    < / status >
    < status >
    < > 301 statusCode < / statusCode >
    < statusDateclass = "sql-date' > 2008 - 02 - 05 < / statusDate >
    < user name > DMS_WORKFLOW < / userId >
    < comment > < / comment >
    < / status >
    < / ocaStatus >

    The XML is very long. For insertion in the table, I use xmlparse() function to get XMLType.
    While doing this I'm ORA-01704: string literal too long error. It is said can accommodate maximum 4,000 characters.
    I guess that XMLType is stored as a default CLOB. So it should allow more than 4000 characters.
    How can I store data xml with more than 4000 characters.

    Thank you.

    XMLParse is a SQL function, you cannot use a string literal is longer than 4000 characters.

    Instead, you can declare a PL/SQL VARCHAR2 variable, which can contain up to 32 k characters and use the XMLType constructor:

    DECLARE
    
     xmlstr VARCHAR2(32767) := '';
     xmldoc xmltype;
    
    BEGIN
    
     xmldoc := xmltype(xmlstr);
     INSERT INTO your_table(xml_data) VALUES(xmldoc);
    
    END;
    

    For strings longer than 32 k, you may need to load it from a file.

  • Help - query on the XMLType column?

    Hello

    Please could someone help me to write a query to extract data from XMLType column in the script below:

    Here is my example of WHAT XML stored in the XMLType column:
     <?xml version="1.0" encoding="UTF-8"?>
    <cf:IncidentReportGroup xmlns:cf="http://xml.crossflo.com/jxdm/3.0.3"
    xmlns:j="http://www.it.ojp.gov/jxdm/3.0.3" xmlns:ext="http://xml.crossflo.com/jxdm/3.0.3/extension"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:i="http://www.it.ojp.gov/jxdm/appinfo/1">
        <cf:IncidentReport>
            <ext:Incident>
                <j:ActivityID>
                    <j:ID>99999999999999</j:ID>
                </j:ActivityID>
                <j:ActivityDate>2007-01-13</j:ActivityDate>
                <j:ActivityTime>01:25:00Z</j:ActivityTime>
            </ext:Incident>
        </cf:IncidentReport>
    </cf:IncidentReportGroup>
    I want to retrieve ActivityDate and ActivityTime where ActivityID/ID = 'something'...

    Here is the example query I wrote but no luck:
    SELECT extractValue(xml_doc, '/cf:IncidentReport/ext:Incident/j:ActivityDate','/cf:IncidentReport/ext:Incident/j:ActivityTime')
      FROM TABLEA 
      where existsNode(xml_doc,'/cf:IncidentReport/ext:Incident/j:ActivityID[j:ID="99999999999999"]')
     
    SQL>  var ID varchar2(20)
    
    SQL>  exec :ID := '99999999999999'
    PL/SQL procedure successfully completed.
    
    SQL>  with t as (
     select xmltype('
    
        
            
                
                    99999999999999
                
                2007-01-13
                01:25:00Z
            
        
    ') xml from dual
    )
    select t2.*
      from t t, xmltable(xmlnamespaces('http://xml.crossflo.com/jxdm/3.0.3/extension' as "ext",
                                       'http://www.it.ojp.gov/jxdm/3.0.3' as "j"),
                         'ext:Incident[j:ActivityID/j:ID=$ID]'
                         passing t.xml.extract('//ext:Incident','xmlns:ext="http://xml.crossflo.com/jxdm/3.0.3/extension"'),
                                 xmlelement(ID, :ID) as ID
                         columns ActivityID   varchar2(10) path 'j:ActivityID',
                                 ActivityDate varchar2(10) path 'j:ActivityDate',
                                 ActivityTime varchar2(10) path 'j:ActivityTime') t2
    /
    ACTIVITYID ACTIVITYDA ACTIVITYTI
    ---------- ---------- ----------
    9999999999 2007-01-13 01:25:00Z
    1 row selected.
    

    Published by: michaels2 on March 2, 2009 08:43

  • How to use SQL * Loader to load the XMLType column with other columns?

    Hello

    I try to use sqlldr to load an XML file into a table with an XMLType column. I have found many examples where the entire table is an xmltype, but I'd like to load a lot of XML objects in a generic table for treatment with a single XMLType column and other columns to identify the load. A simple example, I have a constant column which I want to put during the download.

    The following example does not work: (.) No error either.

    create the table xml_upload
    (the varchar2 (10) of upload_type not null,)
    donnees_xml XMLType)
    /

    my control file:
    DOWNLOAD THE DATA
    INFILE * add
    IN THE TABLE xml_upload
    XMLType (xml_data)
    FIELDS ENDED BY ',' POSSIBLY FRAMED BY "" "
    (
    constant upload_type MARKET,
    donnees_xml
    )
    BEGINDATA
    < SALE_ORDER >
    TIM < CUST_CODE > < / CUST_CODE >
    < ORDER_NUM > 1234 > < / ORDER_NUM >
    < / SALE_ORDER >


    $ sqlldr my.ctl

    SQL * Loader: Release 10.2.0.4.0 - Production on Sun Sep 27 22:51:52 2009

    Copyright (c) 1982, 2007, Oracle. All rights reserved.

    Commit the point reached - the number of logical records 4

    SQL > select * from xml_upload;
    no selected line
    SQL >

    Any ideas on how I can do this? Did I miss something...

    I also played with the clause sqlldr lobfile, also without success.

    Current database version is 10g R2.

    Thank you
    Tim.

    The following works in 11.1.0.6

    LOAD DATA
    INFILE *
    INTO TABLE xml_upload TRUNCATE
    (
     upload_type constant 'MARKET'
    ,file_name filler char(100)
    ,xml_data LOBFILE (file_name) TERMINATED BY EOF
    )
    BEGINDATA
    test.xml
    
    SQL> select upload_type,xmlserialize(document xml_data no indent) from xml_upload;
    
    UPLOAD_TYP XMLSERIALIZE(DOCUMENTXML_DATANOINDENT)
    ---------- ----------------------------------------------------------------------
    MARKET        1
    
    SQL> 
    
  • excerpt from the XMLType column

    In my XMLType column I'm storing XML content that is the xml below.

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

    < project >

    < basics >

    < attribute name = "Id" > 3197915 < / attribute >

    < attribute name = "Name" > 345 < / attribute >

    < attribute name = "Révision" / >

    < name of attribute 'Type' = > project < / attribute >

    < / basics >

    < relationship / >

    < children >

    < application >

    < basics >

    < name of attribute 'Type' = > Application < / attribute >

    < attribute name = "Name" > rty < / attribute >

    < = "Scope" attribute name > SCOPE_PROJECT < / attribute >

    < attribute name = "Révision" / >

    < attribute name = "Id" > 3197918 < / attribute >

    < / basics >

    < relationship type = "Project relationship Configuration" >

    < attribute name = "Subclassification subcomponent" / >

    < attribute name = 'Type of subcomponent' / >

    < attribute name = "Quantity" > 1 < / attribute >

    < attribute name = "Unit of measurement" / >

    < = "Scope" attribute name > SCOPE_PROJECT < / attribute >

    < attribute name = "Post number" / >

    < attribute name = "Additional Information" / >

    < / relationship >

    < children / >

    < / application >

    < typical >

    < basics >

    < name of attribute 'Type' = > rrrr < / attribute >

    < attribute name = "Name" > rrr_Mo < / attribute >

    < attribute name = "Id" > 944674 < / attribute >

    < = "Scope" attribute name > SCOPE_GLOBAL < / attribute >

    < attribute name = "Révision" / >

    < / basics >

    < children / >

    < / typical >

    < application >

    < basics >

    < name of attribute 'Type' = > Application < / attribute >

    < attribute name = "Name" > yu123 < / attribute >

    < = "Scope" attribute name > SCOPE_PROJECT < / attribute >

    < attribute name = "Révision" / >

    < attribute name = "Id" > 3197922 < / attribute >

    < / basics >

    < children / >

    < / application >

    < / children >

    < / project >

    How to write a query to extract the Application name?

    Here, it should return "anais" and "yu123".

    I'm using Oracle 11 g.

    Thanks in advance.

    Something like the following, where TMP_XML. DOC is my XMLType column:

    SQL> select x.*
      2  from tmp_xml t
      3     , xmltable('/Project/Children/Application/Basics'
      4         passing t.doc
      5         columns application_name varchar2(30) path 'Attribute[@Name="Name"]'
      6       ) x
      7  ;
    
    APPLICATION_NAME
    ------------------------------
    rty
    yu123
    
  • Compare the values of the XMLType column to two different lines using XMLDiff in GR 11, 2

    I have a table of data with a row of XMLType and I need a way to compare the XML data against the other. I guess I could use a function and return a XMLDIFF base output to the caller, but the function logic is a bit fuzzy. Would be nice to format the output finally in a table format.

    I looked on http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions241.htm#SQLRF20025 and output in a format of table as shown in Re: how to find compare and identify between xmldocs .

    I ran across some examples do not explain the best way to compare the XML code that is in the best performing XMLType column.

    Any help would be appreciated.

    Are you referring to different rows in the same table or different tables or?

    Basically, you need to change the example of Odie so that the XMLDiff retrieves the XML from places in Pb, say something like

    XMLDIFF(SELECT aXml FROM table WHERE ...,
            SELECT bXml FROM table WHERE ...)
    

    This allows to avoid bringing the XML of the DB in the client code.

    Don't know if that's what you're looking for, but hopefully it helps a little.

  • Cannot load in the XMLTYPE column

    HI gentlemen,

    I have enormous difficulty with loading the XML content in an XMLTYPE column. Here's the annotated schemas:
    SQL> select any_path from resource_view where any_path like '%GKSADMIN/ICD%';
    
    ANY_PATH                                                                        
    --------------------------------------------------------------------------------
    /sys/schemas/GKSADMIN/ICD                                                       
    /sys/schemas/GKSADMIN/ICD/datentypen_V1.40.xsd                                  
    /sys/schemas/GKSADMIN/ICD/ehd_header_V1.40.xsd                                  
    /sys/schemas/GKSADMIN/ICD/ehd_root_V1.40.xsd                                    
    /sys/schemas/GKSADMIN/ICD/icd_body.xsd                                          
    /sys/schemas/GKSADMIN/ICD/icd_header.xsd                                        
    /sys/schemas/GKSADMIN/ICD/icd_root.xsd                                          
    /sys/schemas/GKSADMIN/ICD/keytabs_V1.40.xsd                                     
    
    8 Zeilen ausgewählt.
    And here's the relational table:
    SQL> describe icd
     Name                                      Null?    Typ
     ----------------------------------------- -------- ----------------------------
     ID                                                 CHAR(2)
     XML_DOCUMENT                                       SYS.XMLTYPE(XMLSchema "ICD/i
                                                        cd_root.xsd" Element "ehd") 
                                                        STORAGE Object-relational TY
                                                        PE "ICD$ICD_ROOT_TYP"
    Now, when I try to load a document instance (which proved OK with xmloracle), the following occurs:
    SQL> @loadxmlfileascolumn_int
    Geben Sie einen Wert für source_directory ein: c:\gks\kbv\c\icd\xml
    alt   1: create or replace directory SOURCE_DIR as '&source_directory'
    neu   1: create or replace directory SOURCE_DIR as 'c:\gks\kbv\c\icd\xml'
    
    Verzeichnis wurde erstellt.
    
    Geben Sie einen Wert für xmltypetable ein: icd
    alt   4:   INSERT INTO &XMLTypeTable
    neu   4:   INSERT INTO icd
    Geben Sie einen Wert für id ein: 01
    Geben Sie einen Wert für instancedocument ein: icdtest.xml
    alt   5:     VALUES (&id, XMLType(bfilename('SOURCE_DIR', '&InstanceDocument'),
    neu   5:     VALUES (01, XMLType(bfilename('SOURCE_DIR', 'icdtest.xml'),
    declare
    *
    FEHLER in Zeile 1:
    ORA-01830: Datumsformatstruktur endet vor Umwandlung der gesamten 
    Eingabezeichenfolge 
    ORA-06512: in Zeile 4 
    
    
    SQL> spool off
    Because the patterns are very big, I took only one to show the relevant parts:
        <ehd:document_type_cd V="ICD" DN="ICD-Stammdatei" S="1.2.276.0.76.5.100"/>
        <ehd:service_tmr V="2010-01-01..2010-12-31"/>
        <ehd:origination_dttm V="2009-11-10+01:00"/>
    Guilty is allegedly origination_dttm with its time zone. However, consider the resolution of type below that leads to XS: date. This should be able to accommodate the time zone as well.
         <!-- ************************ origination_dttm_typ ********************************* -->
         <xs:element name="origination_dttm" type="origination_dttm_typ">
              <xs:annotation>
                   <xs:documentation>Erstellungsdatum</xs:documentation>
              </xs:annotation>
         </xs:element>
         <xs:complexType name="origination_dttm_typ">
              <xs:complexContent>
                   <xs:extension base="v_date_typ"/>
              </xs:complexContent>
         </xs:complexType>
    
         v_date_typ: enthält nur den V-Attribut für einfache Datums-Angaben
    
         <!-- ************************ v_date_typ ********************************** -->
         <xs:complexType name="v_date_typ">
              <xs:attribute name="V" type="xs:date" use="required"/>
         </xs:complexType>
    When I delete the passage of time zone in the document instance, it works again.
    (However, another error will be reported then - another question.)

    Can you help me to know what is the problem? Is this my error or a bug?

    Thank you, best regards,.

    Miklós HERBOLY

    Published by: mh * July 3, 2011 10:55

    It's Oracle functionality (at least in 11g R2). See working with zones of the XML DB Developer's Guide: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16659/xdb05sto.htm#autoId62

    The chapter also includes an example how to adjust the schema with Oracle specific annotation.

    See also http://stackoverflow.com/questions/6370035/why-dbms-xmlschema-fails-to-validate-a-valid-xsdatetime/6382096#6382096

    Published by: 836290 on July 4, 2011 07:56

  • Creating indexes in the XMLType column

    Hello

    I have the following for XML document stored as an XMLType column.

    < ocaStatus xmlns = "http://xmlbeans.apache.org/ocastatus" > < status > < > 934 statusCode < / statusCode > < statusDate > Wed Apr 07 16:05:53 GMT + 05:30 2010 < / statusDate > < userId > u0121845 < / userId > < comment > sent to FLC < / comment > < / status > < status > < statusCode > 934 < / statusCode > < statusDate > Wed Apr 07 15:58:25 GMT + 05:30 2010 < / statusDate > < userId > u0121845 < / username > < Comment > sent to FLC < / comment > < / status > < status > < statusCode > 934 < / statusCode > < statusDate > Wed Apr 07 15:54:02 GMT + 05:30 2010 < / statusDate > < userId u0121845 > < / userId > < comment > sent to FLC < / comment > < / status > < status > < statusCode > 750 < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < u0121845 userId > < / userId > < comment > metadata of the Document is correct. < / comment > < / status > < status > < statusCode > 934 < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < userId > u0121845 < / userId > < comment > sent to FLC < / comment > < / status > < status > < statusCode > 932 < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < userId > u0121845 < / username > < comment > loaded Novus < /. comment > < / status > < status > < > 700 statusCode < / statusCode > < statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate > < userId u0121845 > < / userId > < comment > Document is deleted from the OCA. < / comment > < / status > < / ocaStatus >

    I created as a result of the clues in the XML
    CREATING INDEX 'OCA_DEV '. "' OCA_STATUS_CODE_INDEX ' ON 'OCA_DEV '. "DOCUMENT_STATUS_XML"(EXTRACTVALUE('/ocaStatus/status/statusCode'));
    CREATING INDEX 'OCA_DEV '. "' OCA_STATUS_DATE_INDEX ' ON 'OCA_DEV '. "DOCUMENT_STATUS_XML"(EXTRACTVALUE('/ocaStatus/status/statusDate'));

    However, the problem is that I will be having several status within each XML that violates the indexing.
    Is there a way I can still create indexes for multiple State values in each XML file?

    Thanks in advance.

    Hello

    Take a look at the manual xdb (which version do you use?), for the 10.2 version, see: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb04cre.htm#sthref596
    It describes how you can index an XMLTYPE. Because you describe how you use, take a look at your needs.

    In 11G, you have the XMLINDEX to xmltypes indexing, you will find information here: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb_indexing.htm#CHDFCGGI

    Herald tiomela
    Superconsult.nl

  • Select the XMLTYPE column

    I'm currently running SQL Developer 1.5.5. on Windows XP SP2.

    Do a SELECT with 1 xmltype column blocks Developer SQL redraw. Table and select ist following the example of code.
    The effect is that the sql worksheet is not redrawn. Mouse on the leaves of results brings each column to display except xmltype column.
    SQL> desc ibb_formulardaten
     Name                  Null?    Typ
     ------------------------------ --------------
    
     ID                    NOT NULL NUMBER(10)
     FRM_ID                NOT NULL NUMBER(10)
     DATEN                          XMLTYPE
     STATUS                NOT NULL VARCHAR2(20)
    
    SQL> SELECT id, frm_id, daten FROM ibb_formulardaten WHERE id = 12345;
    Anyone can reproduce for my problem?

    Thanks a lot for any suspicion!
    Christian

    What happens when you run the select statement in SQL * more? It crash?

    Post your insert statements. In this way we can verify it is valid xml.

    You can try to download new SQL Developer. Maybe something got corrupted on your current installation.

    I use "sqldeveloper - 1.5.4.59.40 - no. - jre.

  • Loading XML in the XMLTYPE column by separate components (Oracle 11.2.0.4)

    Hi guys,.

    I'm trying to load the file test.xml:

    <? XML version = "1.0"? >

    " < DB-work xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance ">

    < item id = "DB_100" >

    < AddedInLocal > false < / AddedInLocal >

    < AddedInModify > false < / AddedInModify >

    < / point >

    < item id = "DB_101" >

    < AddedInLocal > false < / AddedInLocal >

    < AddedInModify > false < / AddedInModify >

    < / point >

    < item id = "DB_102" >

    < AddedInLocal > false < / AddedInLocal >

    < AddedInModify > true < / AddedInModify >

    < / point >

    < / DB-work >

    in the table:

    CREATE TABLE TEST_XML

    (REQ_NAME, VARCHAR2 (100),)

    XMLTYPE XML_CONTENT

    )

    Intended result in the table:

    REQ_NAME XML_CONTENT
    DB_100

    < item id = "DB_100" >

    < AddedInLocal > false < / AddedInLocal >

    < AddedInModify > false < / AddedInModify >

    < / point >

    DB_101

    < item id = "DB_101" >

    < AddedInLocal > false < / AddedInLocal >

    < AddedInModify > false < / AddedInModify >

    < / point >

    DB_102

    < item id = "DB_102" >

    < AddedInLocal > false < / AddedInLocal >

    < AddedInModify > true < / AddedInModify >

    < / point >

    Load.CTL file wich is full xml load in 1 card:

    load data

    INFILE *.

    BadFile "test.bad."

    discardfile 'test.dsc '.

    Add

    in the test_xml table

    (ext_file filling 40,

    xml_content (ext_file) lobfile completed by expressions of folklore)

    begindata

    test. XML

    Gurus, could you please help me how should I reconfigure load.ctl file to get the desired result?

    Another option would be to insert the data directly, without using SQL * Loader, such as shown below.  This would require that your data file is on your server, not your client.

    Scott@orcl12c > host type c:\my_oracle_files\test.xml

    http://www.w3.org/2001/XMLSchema-instance">

    fake

    fake

    fake

    fake

    fake

    true

    Scott@orcl12c > CREATE TABLE TEST_XML

    2 (REQ_NAME, VARCHAR2 (100),)

    3 XML_CONTENT XMLTYPE

    4     )

    5.

    Table created.

    Scott@orcl12c > create or replace directory mon_repertoire as 'c:\my_oracle_files '.

    2.

    Created directory.

    Scott@orcl12c > insert into test_xml (req_name, xml_content)

    2 select x.id, x.item

    xmltable 3

    4 ("/ DB/work item")

    5 passage xmltype (bfilename ("Mon_repertoire", "test.xml"), NLS_CHARSET_ID ("WE8MSWIN1252'))

    6 columns

    path of varchar2 (100) 7 id "@id."

    path of xmltype 8 point '.') x

    9.

    3 lines were created.

    Scott@orcl12c > column req_name format a8

    Scott@orcl12c > column xml_content format a60

    Scott@orcl12c > select * from test_xml

    2.

    REQ_NAME XML_CONTENT

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

    DB_100

    fake

    fake

    DB_101

    fake

    fake

    DB_102

    fake

    true

    3 selected lines.

  • best way to query the XMLType column

    Hi all

    I have a table that will structure have as

    create table t (seq_NO FIGURE sys.xmltype xml_file, mydate date);

    This xml_file will have the following structure

    " < envelope SOAP: xmlns:SOAP = ' http://schemas.xmlsoap.org/SOAP/envelope/ ">

    < SOAP: Header / >

    < SOAP: Body >

    < ns1:MY_GetOutRes xmlns:ns1 = "urn:myxyzcompany.com:myxyzcompany_sap_p_i_webs:myRpt" >

    < MY_RESULT >

    < MYCODE > 0000011002 < / MYCODE >

    < > 20010101 MY_DATE < / my_DATE >

    < CURRENT > 111,000 < / CURRENT >

    < MOD > 100,000 < / MOD >

    < > 100,000 AVG < / AVG >

    ABCD < UMS > < / UMS >

    < / MY_RESULT >

    < MY_MSG > Sucsses < / MY_MSG >

    < / ns1:MY_GetOutRes >

    < / SOAP: Body >

    < / envelope SOAP: >

    This xml file will have 200 MYCODES with values. I need to query the values for all MYCODES and extract the values of CURRENT, MOD, AVG etc and insert it in some tables of xyz.

    What is the best way to do this.

    Thank you

    with t as)

    Select xmltype ("http://schemas.xmlsoap.org/soap/envelope/" >)

    0000011002

    20010101

    111,000

    100,000

    100,000

    ABCD

    Sucsses

    xmlDoc ') of double

    )

    Select mycode,

    my_date,

    current_,

    mod_,

    avg_,

    UMS

    t,.

    XMLTable)

    XmlNamespaces)

    "http://schemas.xmlsoap.org/soap/envelope/" as "SOAP."

    "urn:myxyzcompany.com:myxyzcompany_sap_p_i_webs:myRpt" as "ns1."

    ),

    ' /: SOAP envelope / SOAP: Body / ns1:MY_GetOutRes / MY_RESULT'

    passage xmldoc

    columns

    path of varchar2 (20) MyCode ' / MY_RESULT/MYCODE.

    date path my_date ' / MY_RESULT/MY_DATE ',.

    current_ number path "/ MY_RESULT/CURRENT."

    mod_ number path "/ MY_RESULT/MOD."

    avg_ number path "/ MY_RESULT/MOD."

    UMS number path "/ MY_RESULT/MOD.

    )

    /

    MYCODE MY_DATE CURRENT_ MOD_ AVG_ UMS
    -------------------- ------------------- ---------- ---------- ---------- ----------
    0000011002 01/01/2001 00:00:00 111 100 100 100

    SQL >

    SY.

  • Questions to extract the XMLtype column attributes

    I cannot retrieve the values of a column of the XML data type. There are 16 fields and when I try to extract the data the XML snippet is that each of them in 1 great return value. I have tried everything but the problem seems to be that the domain name is an attribute and everything I try fails. I appreciate any help in advance and I'm extremely new XML so please let me know if you need more information.

    With the help of Oracle 11.2.0.2 Express

    -Created table that has a column of XMLTYPE OF CLOB
    CREATE THE TABLE HR. XMLTABLESTORE (key_id VARCHAR2 (10) PRIMARY KEY, xmlloaddate date, xml_column XMLTYPE) AS CLOB XmlType xml_column STORE;

    -Insert the XML code in the column
    INSERT INTO HUMAN RESOURCES. VALUES XMLTABLESTORE (HR. XMLSEQUENCE. NEXTVAL, SYSDATE, XMLType (bfilename ('XMLDIRX', 'PROD_20110725_211550427_220b.xml'),
    nls_charset_id ('AL32UTF8')));

    I managed to get the values for

    SELECT extract (xml_column, ' / / MapItem/@ProductNum "") ProductNum go OF HR. XMLTABLESTORE

    '63481062975'

    Vain, get the data under the domain name, as it is to return all names or values

    SELECT extract (xml_column, ' / / MapItem/Field/@Name "") OF HR. XMLTABLESTORE

    'lowDispUnitsPerPackdosageFormmedicaidUnitTypemedicareUnitTypemedicareUnitsPerPackunitConversiontypeunitMeasurepricingUnitMeasurelabelerCodeproductNumdescriptionlongDescriptiondesiIndicatorgenericBrandTypeendoOrgCode'

    How can I return a row of data both for the name and value?

    <? XML version = "1.0"? > < entries >
    < ProductNum category = NDC "634810629" = "634810629" Name = "634810629" Ndc9Flag = "true" >
    < = field name "type" Type = "java.lang.String" Value = "Category" / > "
    < name of field = "productNum" Type = "java.lang.String" Value = "634810629" / > "
    "" "< MapItem ProductNum = NDC"63481062975"="63481062975"Ndc9Flag ="false"name ="PERCOCET 10/325 MG x 100 UD' status = "0" Description ="PERCOCET 10/325 MG x 100 UD ' MedicaidUnitsPerPack ="100.0"MarketEntryDate ="2001-11-23 00:00:00 "FirstSalesDate =" 2001-11-23 00:00:00 "fdaApprovalDate ="2001-11-23"fdaRegName ="000000006348162975"ManuTermDate ="2003-09-30 00:00:00 "ShelfLifeExpDate =" 2003-09-30 00:00:00 "drugType ="Rx"DrugCategory =" N"TheraCode ="NR"EligibleForVA ="false"EligibleForPHS ="false"EligibleForASP ="false"EligibleForMedicaid ="true"NonCmtyPharmaDrug ="false">"
    * < name of field = "lowDispUnitsPerPack" Type = "java.lang.String" Value = "1000" / > * "
    * < name of field = 'dosageForm"Type =" java.lang.String"Value = 'TAB' / > *"
    * < name of field = "medicaidUnitType" Type = "java.lang.String" Value = 'TAB' / > * "
    * < name of field = "medicareUnitType" Type = "java.lang.String" Value = 'TAB' / > * "
    * < name of field = "medicareUnitsPerPack" Type = "java.lang.String" Value = "100.0" / > * "
    * < name of field = "unitConversion" Type = "java.lang.String" Value = "1" / > * "
    * < = field name "type" Type = "java.lang.String" Value = "Item" / > * "
    * < name of field = 'unitMeasure' Type = "java.lang.String" Value = "EA" / > * "
    * < name of field = "pricingUnitMeasure" Type = "java.lang.String" Value = "EA" / > * "
    * < name of field = "labelerCode" Type = "java.lang.String" Value = "63481" / > * "
    * < name of field = "productNum" Type = "java.lang.String" Value = "63481062975" / > * "
    * < field name = "description" Type = "java.lang.String" Value ="PERCOCET 10/325 MG x 100 UD" / > * "
    * < field name = "longDescription" Type = "java.lang.String" Value ="PERCOCET 10/325 MG x 100 UD" / > * "
    * < name of field = "desiIndicator" Type = "com.modeln.bp.catalog.CMnDesiDrugIndicator" Value = "2" / > * "
    * < name of field = "genericBrandType" Type = "com.modeln.bp.struct.contract.enums.CMnGenericBrandItemType" Value = "BRND" / > * "
    * < name of field = "endoOrgCode" Type = "java.lang.String" Value = "0010" / > * "
    < / MapItem >
    < / category >
    < / input >

    Thank you
    Shawn

    You can get a picture with lines like ['name', 'value']

    with t as
    (select xmltype('
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ') xml from dual)
    
    select  x.name, x.value
    from t
        ,xmltable('/Entries/Category/MapItem/Field'
                  passing t.xml
                  columns name varchar2(20) path '@Name',
                   value varchar2(20) path '@Value'
                 ) x 
    
    NAME                 VALUE
    -------------------- --------------------
    lowDispUnitsPerPack  1.000
    dosageForm           TAB
    medicaidUnitType     TAB
    medicareUnitType     TAB
    medicareUnitsPerPack 100.0
    unitConversion       1
    type                 Item
    unitMeasure          EA
    pricingUnitMeasure   EA
    labelerCode          63481
    productNum           63481062975
    description          PERCOCET 10/325MG x
    longDescription      PERCOCET 10/325MG x
    desiIndicator        2
    genericBrandType     BRND
    endoOrgCode          0010                 
    
    16 rows selected           
    
  • calculate the amount of nodes in the XMLTYPE column

    I'm in ORACLE 10 g 10.2.0.4.0

    There is a table BOOK)
    ID NUMBER (10.0).
    XML_COLUMN XMLTYPE)

    XML_COLUMN looks like

    < Book bookCode = Classtest "ae1" = "0" title = "MasteringChemistry for 1st Averill/Eldredge" >
    < description / >
    < sectionTierLabels >
    < sectionTier label = "Left" >
    < sectionTier label = "Chapter1" >
    < sectionTier label = "Chapter 2" >
    .
    .
    .
    < sectionTier label = "Section" / >
    < / sectionTier >
    < / sectionTier >
    < / sectionTierLabels >
    < / book >

    Different records has a different number of chapters.

    I should get a result like

    Label sectionTier BOOKID
    1234 1 part
    1234 2 Chapter 1
    1234 3 Chapter 2
    1234 section 4
    1111 1 part
    1111 2 Chapter 1
    1111 3 Chapter 2
    4 1111 Chapter 3
    1111 section 5

    No idea how to do it?

    Thank you
    Julia

    Published by: 795070 on Sep 17, 2010 11:33

    Published by: 795070 on Sep 17, 2010 11:49

    Published by: 795070 on Sep 17, 2010 12:08

    Hello

    Strange structure for your XML data, are really nested elements sectionTier or is it a mistake?
    If the first case, try the following:

    SELECT b.bookid, x.*
    FROM book b,
         XMLTable(
          '/book/sectionTierLabels//sectionTier'
          passing b.xml_column
          columns
           sectionTier for ordinality,
           label       varchar2(30) path '@label'
         ) x
    ;
    

Maybe you are looking for

  • 15 - r018dx: Wireless card driver (Realtek RTL188EE 802.11 bgn) 'Crash '.

    I had the ongoing problem of losing internet connection randomly. When I fix the problem, it is said: Adapter Wi - Fi adapter Realtek RTL188EE 802.11 bgn knows driver - or hardware problemsA network cable is not plugged in correctly or may be broken

  • Windows Update does not work

    Hey,. I tried to get the solution to this problem myself, through various types of support is Web, but nothing seems to help. First update of Windows gave code 080070424, and after cleaning the Software Distribution folder, he turned to code 80070002

  • Aspire XC-605 Downgrade from Windows 8 for Windows 7

    Hi people, I need quick tips on a desktop PC Acer Aspire XC-605 and hope you can help me. My boyfriend just bought an Acer Aspire XC-605 for his family to use. It comes with Windows 8, but he hates this OS. He called me yesterday and asked if I could

  • I get the error code 2908 when I try to install Windows 7 Premium update for mVista

    Setup has encountered an unexpected error installing this package.  This may indicate a problem with this package.  The error code is 2908.

  • How to restore your entire computer.

    Hello, Ive had this problem for awhile now. I don't know how to restore my computer everything. Ive tried about three times in about a year and it hasent worked... And I was wondering if there are other ways the simply by pressing F5 on start upward.