Update XML data stored in CLOB Column

Hi All,
i am new to Oracle and new to SQL
i am trying to update XML data stored in CLOB cloumn,data is stored with the follwoing format
<attrs><attr name="name"><string>Schade</string></attr></attrs>
i am using the following query for updating the value
UPDATE PRODUCT p SET ATTRIBUTES_nl_nl=UPDATEXML(XMLTYPE.createXML(ATTRIBUTES_nl_nl),'/attrs/attr[@name="name"]/string/text()','Schade').getClobVal() WHERE p.sku='000000000000040576_200911-5010057'
this query is working fine but it changing the data to the following format
<attrs><attr name="name">Schade</attr></attrs>
some how it is ommiting the <string> tag from it, i am unable to figure it out whats the reason.
any help in this regard will b e much appriciated
Thanks in Advance
-Umesh

Hi,
You should have created your own thread for this, and included database version.
This works for me on 11.2.0.2 and 10.2.0.5 :
SQL> create table t_org ( xml_clob clob );
Table created
SQL>
SQL> insert into t_org
  2  values(
  3  '<Message>
  4  <Entity>
  5  <ASSIGNMENT>
  6  <OAVendorLocation> </OAVendorLocation>
  7  <Vendorid>1</Vendorid>
  8  </ASSIGNMENT>
  9  </Entity>
10  </Message>'
11  );
1 row inserted
SQL> commit;
Commit complete
SQL> select '*' ||
  2         extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
  3         || '*' as result
  4  from t_org;
RESULT
SQL> update t_org set xml_clob =
  2  updatexml(xmltype(xml_clob),
  3  '/Message/Entity/ASSIGNMENT/OAVendorLocation/text()','LONDON').getClobVal()
  4  ;
1 row updated
SQL> select '*' ||
  2         extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
  3         || '*' as result
  4  from t_org;
RESULT
*LONDON*
Does the OAVendorLocation really have a whitespace value?
If not then it's expected behaviour, you're trying to update a text() node that doesn't exist. In this case, the solution is to use appendChildXML to create the text() node, or update the whole element.
Is it your real document? Do you actually have some namespaces?

Similar Messages

  • Trying to Insert an XML Element into XML data stored in CLOB column

    Hi all,
    My ORACLE DB version is:
    ('Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production');
    ('PL/SQL Release 11.2.0.2.0 - Production');
    ('CORE 11.2.0.2.0 Production');
    ('TNS for Linux: Version 11.2.0.2.0 - Production');
    ('NLSRTL Version 11.2.0.2.0 - Production');
    I have this XML data stored in a CLOB column:
    <Activity>
         <Changes>     
         </Changes>
         <Inserts>     
         </Inserts>
         <Definition>     
         </Definition>
         <Assignment TYPE="Apply">     
         </Assignment>
         <Spawned>
              <Activity>576D8CD9-57A1-8608-1563-8F6DC74BDF3C</Activity>
              <Activity>11226E79-5D24-02EB-A950-D34A9CCFB3FF</Activity>
              <Activity>DAA68DC0-CA9A-BB15-DE31-9596E19513EE</Activity>
              <Activity>93F667D6-966A-7EAD-9B70-630D9BEFDDD2</Activity>
              <Activity>FA63D9D3-86BB-3FF0-BE69-17EAA7581637</Activity>
         </Spawned>
         <SpawnedBy>AFC49BD4-5AA7-38C0-AE27-F59D16EE1B1C</SpawnedBy>
    </Activity>
    I am in need of some assistance in creating an update that will insert another <Activity>SomeGUID</Activity> into the <Spawned> parent.
    Any help is greatly appreciated.
    Thanks.
    Edited by: 943783 on Dec 14, 2012 12:58 PM

    See XML updating functions : http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb04cre.htm#i1032611
    For example :
    UPDATE my_table t
    SET t.my_clob =
          XMLSerialize(document
            insertChildXML(
              XMLParse(document t.my_clob)
            , '/Activity/Spawned'
            , 'Activity'
            , XMLElement("Activity", 'Some GUID')
    WHERE ...
    ;Although it works, there's overhead introduced by parsing the CLOB, then serializing again.
    Is there any chance you can change the CLOB to SECUREFILE binary XMLType storage instead?
    You would then be able to benefit from optimized piecewise update of the XML and improved storage.

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • How to read XML data stored in CLOB in Concurrent prog Output

    Hi All,
    I'm trying to Generate the XML Data as concurrent Program output. I have a PL/SQL package which generated the XML data by using SQL/XML functions. I'm storing the generated XML data in a CLOB variable. But when i try to read the data using fnd_file.put_line(fnd_file.OUTPUT,XML_Data) it doesn't display data more than 32767 bytes.
    Please help me out to understand what could be done to read the data in chunks. I have tried many logic's to print chunks of data but the output tags are either chopped off and errors out saying Tag not found.
    My logic is as below:
    v_handler:= DBMS_XMLGEN.newContext(v_xml_query);
    --Sets NULL handling options
    DBMS_XMLGen.SetNullHandling(v_handler, dbms_xmlgen.EMPTY_TAG ) ;
    --Set special character handling
    DBMS_XMLGEN.setConvertSpecialChars(v_handler, TRUE);
    -- Specified whether to use an XML attribute to indicate NULLness of particular entity in the XML document
    DBMS_XMLGen.useNullAttributeIndicator(v_handler,TRUE);
    -- set Checking invalid chars
    DBMS_XMLGEN.setCheckInvalidChars(v_handler, TRUE);
    -- get the xml data as required
    v_xml_data:= DBMS_XMLGEN.getXMLtype(v_handler);
    SELECT XMLROOT(v_xml_data.extract('/*'),VERSION '1.0').getClobVal() into v_new_xml_Data from dual;
    -- get the length of the xml generated
    v_clob_len := dbms_lob.getlength(v_new_xml_Data);
    FND_FILE.PUT_LINE(FND_FILE.LOG,'The Clob length is :'|| v_clob_len);
    -- logic to process string more than 32767 Processing by each character
    v_offset :=1;
    while (v_offset <= v_clob_len)
    LOOP
    v_char := dbms_lob.substr(v_new_xml_Data, 1, v_offset);
    IF (v_char = CHR(10))
    then
    fnd_file.new_line(fnd_file.output, 1);
    else
    fnd_file.put(fnd_file.output, v_char);
    end if;
    v_offset := v_offset + 1;
    END LOOP;
    FND_FILE.PUT_LINE(FND_FILE.LOG,'The offset is :'|| v_offset);
    FND_FILE.NEW_LINE(FND_FILE.OUTPUT, 1);
    THe above logic is for character by character which is a performance burden? Please let me know if there is any other work around for this

    Hi,
    Thanks for Replying. I have refered http://blog.oraclecontractors.com/?p=69 and then i added that piece of code. Basically, i'm trying to generate a report using XML publisher. To generate the XML data i'm writing a pl/sql package with SQl/XML functions. DBMS_XMLGEN would help me convert the XML Data as is. When the concurrent program runs this XML data will merge with RTF layout and generate required report. I'm able to generate the Report for data less then 32767 bytes. More than the limit i need to pass chunks of XML data to read as output. That's the reason i'm using fnd_file.output. But it reads only 32767 size at a time.
    WHen i use the given logic, it works perfectly fine, but it loops for each character, for example if you have 30,000 characters it loops the same, which is peformance burden.
    So i tried to write the logic of chunks but still i get the error that XML tag is not found or missing. I'm hoping this is very common issue, but after all my trails, i didn't find the right solution.
    the other logic i tried was :
    v_new_xml_data varchar2(32767)
    v_iterations := CEIL(v_clob_len/v_chunk_length); -- v_chunk_length is 32767 and v_clob_length is length of the XML data stored inthe clob variable
    For i in 0..v_iterations
    LOOP
    FND_FILE.put_line (fnd_file.log,'the loops v_pos :'||i||' and v_clob_length :'||v_clob_len);
    v_new_xml_data := DBMS_LOB.SUBSTR ( V_XML_DATA,v_chunk_length,(i*v_chunk_length)+1);
    FND_FILE.PUT_LINE (FND_FILE.OUTPUT,v_new_xml_data); -- read the output for every 32767 chunks
    FND_FILE.PUT_LINE(FND_FILE.LOG, 'Chunk length is :'||((i*v_chunk_length)+1));
    END LOOP;
    FND_FILE.put_line (fnd_file.log,'out of loop');
    FND_FILE.put_line (fnd_file.log,'length of new xml is '||v_clob_len);
    Please, let me know if you need Further clarifications on the same.

  • Parsing XML data stored as CLOB in DB and save attribute values in table

    Hello,
    I have a CLOB column in table that is holding XML data as follows,
    <banners>
    <banner-image id="0">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>www</click-through-url>
    <make>Acura</make>
    </banner-image>
    <banner-image id="1">
    <type>BANNER</type>
    <local-path>http.gif</local-path>
    <click-through-url>gfrty</click-through-url>
    <make>BMW</make>
    </banner-image>
    </banners>
    Now I need to parse thru the above XML data and pull the attribute values to store in another table as follows,
    BANNER_IMAGE_ID | TYPE | LOCAL_PATH | CLICK_URL | MAKE
    0 | BANNER | http.gif | www | Acura
    1 | BANNER | http.gif | gfrty | BMW
    And XML data doesn't always end up with 2 rows in this table....some times it may be 3 or 4 as well. It is just that in this example it ended up with 2 rows.
    So, I would appreciate if someone can help me find a generic way of doing this,
    Thank you in advance,
    Madhu.

    This is not a reply.. sorry.
    I took have a similar problem only..
    can you pls help me
    XML structure.
    <PODetails>
    <POHeader>
    <CurrencyID>INR</CurrencyID>
    <ExchangeRate>1</ExchangeRate>
    <RefNo>0080000110</RefNo>
    <VendorID>1200</VendorID>
    <TransDate>2006-12-20</TransDate>
    <DocRelationshipId>PURCHASE</DocRelationshipId>
    <LocationID>0000102327</LocationID>
    </POHeader>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>L HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>3.000</Quantity>
    <PriceValue>2509.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1332</ItemID>
    <Size>M HS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>2.000</Quantity>
    <PriceValue>1673</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    <POItemDetails>
    <ItemID>ARSH1556</ItemID>
    <Size>39FS</Size>
    <Quality>Q1</Quality>
    <CustPO>rush order</CustPO>
    <UOM>PC</UOM>
    <Quantity>1.000</Quantity>
    <PriceValue>836.5</PriceValue>
    <TaxAmount>0.00</TaxAmount>
    </POItemDetails>
    </PODetails>
    The DB is ORACLE 9i
    This is stored in a XML table of type XMLTYPE.
    THIS I USED THE .extract function to get the values of the nodes.
    POHeader details are working fine. But when i get the POItemDetails i am getting 'ARSH1332ARSH1332ARSH1556' when i issue the command
    select a.extract('/PODetails/POItemDetails/ItemID/text()').getStringVal() ItemID
    FROM xmltable a
    WHERE a.existsnode('//POItemDetails/ItemID')=1
    Pls Help..
    Regds,
    Santhoshkumar.G.

  • Form or form on report to update XML tagS stored in CLOB field.

    I would like to create a form or a form on a report
    where i can update xml tags. The xml data is stored in a CLOB field.
    sample CLOB DATA
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE preferences SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>
    <preferences EXTERNAL_XML_VERSION="1.0">
    <root type="user">
    <map />
    <node name="com">
    <map />
    <node name="mynode">
    <map />
    <node name="utils">
    <map />
    <node name="properties">
    <map>
    <entry key="Save" value="ON" />
    <entry key="TM_PORT" value="55555" />
    <entry key="TM_PORT2" value="7777" />
    <entry key="SubID" value="all" />
    <entry key="UserDBUsr" value="myuser" />
    <entry key="JMS_JDBC" value="OFF" />
    <entry key="Side" value="BUY" />
    <entry key="HEALTH_MONITOR_CRITICAL_DISK_SPACE" value="500" />
    <entry key="HEALTH_MONITOR_WARNING_DISK_SPACE" value="750" />
    <entry key="HEALTH_MONITOR_PERIOD" value="600000" />
    </map>
    </node>
    </node>
    </node>
    </node>
    </root>
    </preferences>
    the goal is to have a form where i can view and update the "value" of following:
    TM_PORT
    TM_PORT2
    SubID
    UserDBUsr
    JMS_JDBC
    Side
    HEALTH_MONITOR_CRITICAL_DISK_SPACE
    HEALTH_MONITOR_WARNING_DISK_SPACE
    HEALTH_MONITOR_PERIOD
    I have searched around this forum but could not find an example.
    it would be cool if I could also load the an xml file into the clob.
    Thank you.

    Hi,
    I think you just study first the topics about XML DB to understand how to manupulate xml data in the database.
    See:
    http://www.oracle.com/technology/tech/xml/xmldb/index.html
    and
    XML DB
    Regards,
    Cafer

  • How to read XML Data stored as Clob

    Hi
    I am new to clob & XML types...
    An XML data has been inserted into a Clob field in a Oracle(9.2.0.8.0) Table
    CREATE TABLE TEMP
    SNO NUMBER(5),
    STR_VAL LONG,
    CREATED_DT DATE DEFAULT sysdate,
    COL2 CLOB,
    COL3 SYS.XMLTYPE
    SELECT dbms_lob.getlength(col2) from temp
    ->24754
    SQL> select col2 from temp;
    COL2
    &lt;DataSet1&gt;
    &lt;TAGSDATATABLE&gt;
    &lt;TAG_NAME&gt;KST20001&lt;/TAG_NA
    If i use the above stmt it shows only pice of data
    how can i get the actual data from this column.
    could anyone help to get the data.
    Regards
    Prakash
    Edited by: user12957183 on Aug 25, 2010 12:25 AM

    Insert data in to XMLTYPE table from clob variable:
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2  my_clob CLOB := '<DataSet1><TAGSDATATABLE><TAG_NAME>KST20001</TAG_NAME>
      3  </TAGSDATATABLE><TAGSDATATABLE><TAG_NAME>KST20002</TAG_NAME></TAGSDATATABLE>
      4  <TAGSDATATABLE><TAG_NAME>KST20003</TAG_NAME></TAGSDATATABLE>
      5  <TAGSDATATABLE>
      6  <TAG_NAME>KST20004</TAG_NAME>
      7  </TAGSDATATABLE>
      8  <TAGSDATATABLE>
      9  <TAG_NAME>KST20005</TAG_NAME>
    10  </TAGSDATATABLE>
    11  <TAGSDATATABLE>
    12  <TAG_NAME>KST20006</TAG_NAME>
    13  </TAGSDATATABLE>
    14  <TAGSDATATABLE>
    15  <TAG_NAME>KST20007</TAG_NAME>
    16  </TAGSDATATABLE>
    17  <TAGSDATATABLE>
    18  <TAG_NAME>KST20008</TAG_NAME>
    19  </TAGSDATATABLE>
    20  <TAGSDATATABLE>
    21  <TAG_NAME>KST20009</TAG_NAME>
    22  </TAGSDATATABLE>
    23  <TAGSDATATABLE>
    24  <TAG_NAME>KST20010</TAG_NAME>
    25  </TAGSDATATABLE>
    26  <TAGSDATATABLE>
    27  <TAG_NAME>KST20009</TAG_NAME>
    28  </TAGSDATATABLE>
    29  </DataSet1>';
    31  BEGIN
    33  INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob));
    34* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> desc my_tab1;
    Name                                                                                                                  
    TABLE of XMLTYPE
    SQL>
    -- For larger data:
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2  my_clob CLOB := '<DataSet1>
      3  <TAGSDATATABLE>
      4  <TAG_NAME>KST20001</TAG_NAME>
      5  </TAGSDATATABLE>
      6  <TAGSDATATABLE>
      7  <TAG_NAME>KST20002</TAG_NAME>
      8  </TAGSDATATABLE>
      9  <TAGSDATATABLE>
    10  <TAG_NAME>KST20003</TAG_NAME>
    11  </TAGSDATATABLE>
    12  <TAGSDATATABLE>
    13  <TAG_NAME>KST20004</TAG_NAME>
    14  </TAGSDATATABLE>
    15  <TAGSDATATABLE>
    16  <TAG_NAME>KST20005</TAG_NAME>
    17  </TAGSDATATABLE>
    18  <TAGSDATATABLE>
    19  <TAG_NAME>KST20006</TAG_NAME>
    20  </TAGSDATATABLE>
    21  <TAGSDATATABLE>
    22  <TAG_NAME>KST20007</TAG_NAME>
    23  </TAGSDATATABLE>
    24  <TAGSDATATABLE>
    25  <TAG_NAME>KST20008</TAG_NAME>
    26  </TAGSDATATABLE>
    27  <TAGSDATATABLE>
    28  <TAG_NAME>KST20009</TAG_NAME>
    29  </TAGSDATATABLE>
    30  <TAGSDATATABLE>
    31  <TAG_NAME>KST20010</TAG_NAME>
    32  </TAGSDATATABLE>
    33  <TAGSDATATABLE>
    34  <TAG_NAME>KST20009</TAG_NAME>
    35  </TAGSDATATABLE>
    36  <TAGSDATATABLE>
    37  <TAG_NAME>KST20009</TAG_NAME>
    38  </TAGSDATATABLE>
    39  <TAGSDATATABLE>
    40  <TAG_NAME>KST20009</TAG_NAME>
    41  </TAGSDATATABLE>
    42  <TAGSDATATABLE>
    43  <TAG_NAME>KST20009</TAG_NAME>
    44  </TAGSDATATABLE>
    45  <TAGSDATATABLE>
    46  <TAG_NAME>KST20010</TAG_NAME>
    47  </TAGSDATATABLE>
    48  <TAGSDATATABLE>
    49  <TAG_NAME>KST20009</TAG_NAME>
    50  </TAGSDATATABLE>
    51  <TAGSDATATABLE>
    52  <TAG_NAME>KST20009</TAG_NAME>
    53  </TAGSDATATABLE>
    54  <TAGSDATATABLE>
    55  <TAG_NAME>KST20009</TAG_NAME>
    56  </TAGSDATATABLE>
    57  <TAGSDATATABLE>
    58  <TAG_NAME>KST20009</TAG_NAME>
    59  </TAGSDATATABLE>
    60  <TAGSDATATABLE>
    61  <TAG_NAME>KST20010</TAG_NAME>
    62  </TAGSDATATABLE>
    63  <TAGSDATATABLE>
    64  <TAG_NAME>KST20009</TAG_NAME>
    65  </TAGSDATATABLE>
    66  <TAGSDATATABLE>
    67  <TAG_NAME>KST20009</TAG_NAME>
    68  </TAGSDATATABLE>
    69  <TAGSDATATABLE>
    70  <TAG_NAME>KST20009</TAG_NAME>
    71  </TAGSDATATABLE>
    72  <TAGSDATATABLE>
    73  <TAG_NAME>KST20009</TAG_NAME>
    74  </TAGSDATATABLE>
    75  <TAGSDATATABLE>
    76  <TAG_NAME>KST20010</TAG_NAME>
    77  </TAGSDATATABLE>
    78  <TAGSDATATABLE>
    79  <TAG_NAME>KST20009</TAG_NAME>
    80  </TAGSDATATABLE>
    81  <TAGSDATATABLE>
    82  <TAG_NAME>KST20009</TAG_NAME>
    83  </TAGSDATATABLE>
    84  <TAGSDATATABLE>
    85  <TAG_NAME>KST20009</TAG_NAME>
    86  </TAGSDATATABLE>
    87  <TAGSDATATABLE>
    88  <TAG_NAME>KST20009</TAG_NAME>
    89  </TAGSDATATABLE>
    90  <TAGSDATATABLE>
    91  <TAG_NAME>KST20010</TAG_NAME>
    92  </TAGSDATATABLE>
    93  <TAGSDATATABLE>
    94  <TAG_NAME>KST20009</TAG_NAME>
    95  </TAGSDATATABLE>
    96  <TAGSDATATABLE>
    97  <TAG_NAME>KST20009</TAG_NAME>
    98  </TAGSDATATABLE>
    99  <TAGSDATATABLE>
    100  <TAG_NAME>KST20009</TAG_NAME>
    101  </TAGSDATATABLE>
    102  <TAGSDATATABLE>
    103  <TAG_NAME>KST20009</TAG_NAME>
    104  </TAGSDATATABLE>
    105  <TAGSDATATABLE>
    106  <TAG_NAME>KST20010</TAG_NAME>
    107  </TAGSDATATABLE>
    108  <TAGSDATATABLE>
    109  <TAG_NAME>KST20009</TAG_NAME>
    110  </TAGSDATATABLE>
    111  <TAGSDATATABLE>
    112  <TAG_NAME>KST20009</TAG_NAME>
    113  </TAGSDATATABLE>
    114  <TAGSDATATABLE>
    115  <TAG_NAME>KST20009</TAG_NAME>
    116  </TAGSDATATABLE>
    117  <TAGSDATATABLE>
    118  <TAG_NAME>KST20009</TAG_NAME>
    119  </TAGSDATATABLE>
    120  <TAGSDATATABLE>
    121  <TAG_NAME>KST20010</TAG_NAME>
    122  </TAGSDATATABLE>
    123  <TAGSDATATABLE>
    124  <TAG_NAME>KST20009</TAG_NAME>
    125  </TAGSDATATABLE>
    126  <TAGSDATATABLE>
    127  <TAG_NAME>KST20009</TAG_NAME>
    128  </TAGSDATATABLE>
    129  <TAGSDATATABLE>
    130  <TAG_NAME>KST20009</TAG_NAME>
    131  </TAGSDATATABLE>
    132  <TAGSDATATABLE>
    133  <TAG_NAME>KST20009</TAG_NAME>
    134  </TAGSDATATABLE>
    135  <TAGSDATATABLE>
    136  <TAG_NAME>KST20010</TAG_NAME>
    137  </TAGSDATATABLE>
    138  <TAGSDATATABLE>
    139  <TAG_NAME>KST20009</TAG_NAME>
    140  </TAGSDATATABLE>
    141  <TAGSDATATABLE>
    142  <TAG_NAME>KST20009</TAG_NAME>
    143  </TAGSDATATABLE>
    144  <TAGSDATATABLE>
    145  <TAG_NAME>KST20009</TAG_NAME>
    146  </TAGSDATATABLE>
    147  </DataSet1>';
    148  l_xmltype xmltype;
    149  BEGIN
    150  --l_xmltype := my_clob;
    151  INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob));
    152* end;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL> Edited by: AP on Aug 25, 2010 4:46 AM

  • How to use XML data stored in table column in XML Data Definition

    Hi,
    We are using BIP 5.6.3 (Oracle EBS R12).
    We have a table which stores XML data in a column. Is there a way we can use this XML data through a SQL query in XML Data Definition of BI Publisher report instead or writing whole SQL query to fetch same data from Oracle EBS?
    Can some please provide a sample SQL query that we should use in Data Definition?
    Thanks!

    Mark,
    Thanks. This is exactly what I was looking for.
    After doing @Name in both places (SELECT and WHERE clause) it worked.
    Now I have one more question.
    There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
    ORA-19025: EXTRACTVALUE returns value of only one node.
    Cause: Given XPath points to more than one node.
    Action: Rewrite the query so that exactly one node is returned.
    SELECT
    extractValue(value(x), '/AW/@Name') as "AW",
    extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/@Name') = 'OMCR4'

  • How to query XML data stored in a CLOB column

    I don't know XMLDB, so I have a dumb question about querying XML data which is saved as CLOB in a table.
    I have a table (OLAP_AW_PRC), with a CLOB column - AW_XML_TMPL_VAL
    This column contains this xml data - [click here|http://www.nasar.net/aw.xml]
    Now I want to query the data using the xml tags - like returning the name of AW. This is where I am having trouble, how to query the data from AW_XML_TMPL_VAL clob column.
    The following query generates error:
    ORA-31011: XML parsing failed.
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    SELECT
    extractValue(value(x), '/AW/LongName') as "AWNAME"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/Name') = 'OMCR4'
    - Nasar

    Mark,
    Thanks. This is exactly what I was looking for.
    After doing @Name in both places (SELECT and WHERE clause) it worked.
    Now I have one more question.
    There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
    ORA-19025: EXTRACTVALUE returns value of only one node.
    Cause: Given XPath points to more than one node.
    Action: Rewrite the query so that exactly one node is returned.
    SELECT
    extractValue(value(x), '/AW/@Name') as "AW",
    extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/@Name') = 'OMCR4'

  • How to publish XML document whose source is stored in clob column

    I have to create simple application:
    in one table are stored some information about XML documents (date of creation, etc.) and the document source itself in one (unfortunatelly clob type) column.
    The point is to anable users finding document(s) and viewing it.
    Using forms I can search and display information about documents. But I have no idea how to publish XML document whose source is stored in clob column.
    I am using Oracle Portal 3.0 on NT.
    Thanks in advance.

    Hi Sergio,
    This link might be helpful:
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/apex/r31/apex31nf/apex31blob.htm
    Also refer the BLOB Download Format Mask :
    {message:id=9716335}
    Here I have given the format mask for APEX 4.0, which will slightly differ for 3.2.1 and proposed changes
    in the format mask are:
    1) Format Mask: DOWNLOAD
    2) Content Disposition: Inline
    This will be achieved with it:
    >
    But now, my user would like to know if it´s possible that APEX application can OPEN some of these files stored on this BLOB column WITHOUT download it.
    My user would like to see a hiperlink (or button) that, if pressed/acessed, can open a new page (or a page inside application) with the document. He doesn´t need to edit this oppened file. He only wants to see it.
    >
    Hope it helps!
    Regards,
    Kiran

  • Can I create an XSD from XML data in a CLOB?

    Environment:
    Oracle 11.2.0.3 EE on Solaris.
    Very much an XML newbie so please be kind! 
    I have spent the past few days pouring through the documentation and various blogs, especially this one, but ... I need some help.
    I am trying to extract XML data stored in a CLOB and produce a flat file for the user's consumption.
    They have sent me what they think is the XSD for the XML data but when I look at the data in the CLOB I don't see the tags documented in the XSD.
    I'd like to produce an XSD based on the actual data to compare with what they've sent.
    Is this possible?
    I am able to query the XML data using the tags I see in the data using XMLTable and it's working fine.
    Any help is greatly appreciated.
    -gary

    Welcome to the XML side of the world, where you will love it and curse it, just like any other piece of technology.
    So as I understand it, the scope of your operation is to extract information from an XML file and then write that information to disk, correct?
    Some questions
    - Why is the XML stored in a CLOB instead of an XMLType column?  Without knowing the system history, it is a valid question.
    - How big are the XML?  The reason I ask this is because when the XML is stored in XMLType columns (of Object Relational structure or SECUREFILE BINARY XML format), then Oracle can parse the XML substantially easier than when it is stored as a CLOB.  If the XML is fairly small, you may see no performance difference between the two.
    The Oracle DB itself has no built in ability to generate a schema from an XML file.  In order to do that, you would need to use some third party tool that has that functionality built in.  For example, XML Spy can do this.  Other tools can as well, but that is what came to mind first as it is what I use.  The one thing to remember is that the schema it builds represents that one instance of XML.  Other instances of XML may be different and not validate against the schema you generated, but still have been valid against the unknown original schema.
    You can register the schema in the database and then use the XML to create an XMLType instance associated to the schema and then validate the XML that way.  One example can be found at XML DB FAQ and here is another example Re: XML Schema validation
    Hope that helps you continue on.

  • Loading data into a CLOB column

    I need to find out how to load about ten sentences of data into a clob column for a table in the database. I have a pl/sql procedure that loads data from an xml file into various tables in the the database. Recently, we added a column (test_dummy) to one of the tables and defined it as a CLOB. There is a corresponding node (detail_info) in the XML file that maps to this column. I need to figure out how to incorporate this in the pl/sql procedure so that the data in the XML file for the node (detail_info) is loaded into "test_dummy". Any ideas?

    Take it one at a time. Use 'extract' function to extract an XML snippet from a given XML. The question couldn't be more vague. Maybe an example would help?
    Rahul

  • Update of data stored in BLOB of Oracle

    Hi,
    During the update of data stored in BLOB, the data integrity disturbance is happening, so it becomes impossible to receive new data with small volume from the BLOB than the data stored in BLOB.

    Try searching the forums for oracle and lob, there will be plenty of articles.

  • SQL Functions to Update XML Data

    Hi,
    Can anybody please tell me whether SQL Functions to Update XML Data (such as updateXML, insertChildXML, insertXMLbefore etc) are available with oracle 9i or not?
    Please tell me.

    You can also do a describe on SYS.XMLTYPE to see what methods are supported in your release. How would you find e.g. insertChildXML in DESC sys.xmltype? I suppose it is not a Method of the Type: Summary of XMLType Subprograms.

  • Updating an XML data in a table column.

    Hi
    I have a data in XML form stored in a clob column in a table. Now I need to merge an XML data (update) into this XML data.
    For e.g.
    XML 1:
    ======
    <EMP>
    <ROW>
    <CODE>1</CODE>
    <NAME>
    <FIRST>abc1</FIRST>
    <LAST>xyz1</LAST>
    </NAME>
    </ROW>
    <ROW>
    <CODE>2</CODE>
    <NAME>
    <FIRST>abc2</FIRST>
    <LAST>xyz2</LAST>
    </NAME>
    </ROW>
    <ROW>
    <CODE>3</CODE>
    <NAME>
    <FIRST>abc3</FIRST>
    <LAST>xyz3</LAST>
    </NAME>
    </ROW>
    </EMP>
    XML 2:
    ======
    <EMP>
    <ROW>
    <MIDDLE>mno1</MIDDLE>
    </ROW>
    </EMP>
    Result: XML 1 + XML 2 as given below
    ========
    <EMP>
    <ROW>
    <CODE>1</CODE>
    <NAME>
    <FIRST>abc1</FIRST>
    <MIDDLE>mno1</MIDDLE>
    <LAST>xyz1</LAST>
    </NAME>
    </ROW>
    <ROW>
    <CODE>2</CODE>
    <NAME>
    <FIRST>abc2</FIRST>
    <LAST>xyz2</LAST>
    </NAME>
    </ROW>
    <ROW>
    <CODE>3</CODE>
    <NAME>
    <FIRST>abc3</FIRST>
    <LAST>xyz3</LAST>
    </NAME>
    </ROW>
    </EMP>
    As shown above I need to put the "Middle" tag from XML 2 into XML 1 and that to at a specific place in the XML 1 and not just append at the end of XML 1.
    Any solution for?
    Thanks,
    Milton.

    There are two ways to do this:
    1/ DOM API: importNode() and AdoptNode()
    2/ XSLT Transformation

Maybe you are looking for

  • How do you transfer voice memos to itunes?

    I am trying to transfer my voice memos to the latest version of iTunes but I cannot find a way. It used to be simple with the older versions, but now I am having trouble.

  • Server Proxy Creation

    Hi, I am working on a Synchronous scenario with Proxy at receiver side. I have my Inbound message in SPROXY Transaction. Can somebody help me out on the steps to create Proxy and the message structure inside the proxy on ABAP side. Also i need to cal

  • Html/Xml/Css on textfields Tutorials

    hI, I am searching for descriptions and tutorials on CSS and HTML/XML in Flash. What is possible and what is not. I was trying a bit to add images, colors and other styles. Did work but not always clean (i.e. text size, hover style ..). Next thing I

  • Dust Inside my MBP screen? How can I remove it?

    So I noticed some dust or debris inside my screen when I was cleaning it out! I'm never in very dusty rooms and the annoying part is that it's very obvious! How can I remove it (if any way)? Should I take it to Apple? It's only been just over a year

  • WLAN Authentication

    Our wireless network consists of Wireless LAN Controllers and multiple APs.  We require 802.1x authentication on our SSID.  We use IAS as our authentication server for both machines and users.  Each device connecting to our WLAN is required to have a