XMLTYPE  Updation

Hi,
We can extract data from a stored procedure parameter of type XMLType
using the function xslprocessor.valueOf()
Can we update the contents of XMLType in Oracle using a function.If any body knows please help me
Regards,
Aneesh Kumar.P

Hi,
I got the answer .It can be done simply by defining another nodelist and node and use the procedure SetNodeValue.Code is as shown below
CREATE OR REPLACE PACKAGE PKG_XMLTYPE AS
PROCEDURE SET_STUDENT(objXmlType IN OUT xmltype);
END;
show err
CREATE OR REPLACE PACKAGE BODY PKG_XMLTYPE AS
PROCEDURE SET_STUDENT(objXmlType IN OUT xmltype)
IS
Tdoc dbms_xmldom.DOMDocument;
TnodelistStudent dbms_xmldom.DOMNodeList;
TnodeStudent dbms_xmldom.DOMNode;
TnodelistMark dbms_xmldom.DOMNodeList;
TnodeMark dbms_xmldom.DOMNode;
TnodelistM1 dbms_xmldom.DOMNodeList;
TnodeM1 dbms_xmldom.DOMNode;
TChildnodeM1 dbms_xmldom.DOMNode;
TnodelistM2 dbms_xmldom.DOMNodeList;
TnodeM2 dbms_xmldom.DOMNode;
TChildnodeM2 dbms_xmldom.DOMNode;
TYPE tab_type_Mark IS TABLE OF TBLMARK%ROWTYPE;
t_Mark tab_type_Mark := tab_type_Mark();
TYPE tab_type_Student IS TABLE OF TBLSTUDENT%ROWTYPE;
t_STUDENT tab_type_STUDENT := tab_type_STUDENT();
BEGIN
Tdoc := dbms_xmldom.newDOMDocument(objXmlType);
TnodelistStudent := xslprocessor.selectNodes(dbms_xmldom.makeNode(Tdoc),'/clsStudent');
FOR cur_stud IN 0.. dbms_xmldom.getLength(tnodeliststudent)-1 LOOP
t_student.extend;
TnodeStudent := dbms_xmldom.item(tnodeliststudent, cur_stud);
xslprocessor.valueOf(tnodeStudent,'studName',t_student(t_student.last).STUDNAME);
xslprocessor.valueOf(tnodeStudent,'studAge',t_student(t_student.last).studAge);
INSERT INTO tblstudent(STUDNAME,STUDAGE)
VALUES(t_student(cur_stud+1).STUDNAME,t_student(cur_stud+1).studAge);
Tnodelistmark := xslprocessor.selectNodes(dbms_xmldom.makeNode(Tdoc),'/clsStudent/MarkCL/Mark');
TnodelistM1 := xslprocessor.selectNodes(dbms_xmldom.makeNode(Tdoc),'/clsStudent/MarkCL/Mark/M1');
TnodelistM2 := xslprocessor.selectNodes(dbms_xmldom.makeNode(Tdoc),'/clsStudent/MarkCL/Mark/M2');
FOR cur_Mark IN 0 .. dbms_xmldom.getLength(tnodelistmark)-1 LOOP
t_mark.extend;
Tnodemark := dbms_xmldom.item(tnodelistmark, cur_Mark);
xslprocessor.valueOf(tnodemark,'M1',t_mark(t_mark.last).MARK1);
xslprocessor.valueOf(tnodemark,'M2',t_mark(t_mark.last).MARK2);
INSERT INTO tblmark(MARK1,MARK2)
VALUES(t_mark(cur_Mark+1).MARK1,t_mark(cur_Mark+1).MARK2);
TnodeM1 := dbms_xmldom.item(TnodelistM1, cur_Mark);
TchildnodeM1 := dbms_xmldom.getFirstChild(TnodeM1);
dbms_xmldom.setNodeValue(TchildnodeM1, '888');
TnodeM2 := dbms_xmldom.item(TnodelistM2, cur_Mark);
TchildnodeM2 := dbms_xmldom.getFirstChild(TnodeM2);
dbms_xmldom.setNodeValue(TchildnodeM2, '999');
END LOOP;
END LOOP;
COMMIT;
dbms_xmldom.freeDocument(Tdoc);
END SET_STUDENT;
END PKG_XMLTYPE;
show err
Regards,
Aneesh Kumar.P

Similar Messages

  • Xmltype update?

    Hi all - I just have a quick question to do with XMLTYPE columns.
    I have data similar to this:
    <ITEM name="TYPE">
      <NEW_VALUE>UT</NEW_VALUE>
    </ITEM>
    <ITEM name="XD_EOM_IND">
      <NEW_VALUE>Y</NEW_VALUE>
    </ITEM>
    <ITEM name="FID">
      <NEW_VALUE>A</NEW_VALUE>
    </ITEM>and I want to update the element names - i.e. I want "ITEM name='FID'" to be ITEM name = 'DST_TYP' but I can't seem to find how to do this short of doing a find and replace as if the column was plain text.
    is there something I'm missing?

    Hi,
    Try the following :
    WITH t AS (
    SELECT xmltype('<ROOT>
    <ITEM name="TYPE">
      <NEW_VALUE>UT</NEW_VALUE>
    </ITEM>
    <ITEM name="XD_EOM_IND">
      <NEW_VALUE>Y</NEW_VALUE>
    </ITEM>
    <ITEM name="FID">
      <NEW_VALUE>A</NEW_VALUE>
    </ITEM>
    </ROOT>') doc
    FROM dual
    SELECT updatexml(t.doc, '//ITEM[@name="FID"]/@name', 'DST_TYP')
    FROM t;The 2nd argument of UPDATEXML is an XPath expression that selects all nodes (including attributes) to be updated.

  • Error when a try to update a xmltype view thru a trigger instead of update

    <PERSON>
    <ID>4</ID>
    <FIRSTNAME>Frédéric</FIRSTNAME>
    <LASTNAME>Philippekin</LASTNAME>
    <SEX>M</SEX>
    <WEIGHT>75</WEIGHT>
    <HEIGHT>175</HEIGHT>
    </PERSON>
    CREATE OR REPLACE VIEW personne_oracle OF XMLType
    XMLSCHEMA "personOracle.xsd" ELEMENT "PERSON"
    WITH OBJECT ID (EXTRACT(sys_nc_rowinfo$, '/PERSON/ID').getNumberVal())
    AS SELECT XMLELEMENT("PERSON",
              XMLFOREST( Id,
    FirstName,
    LastName,
    Sex,
    Weight,
              Height)
    ) AS Valeur     
    FROM Person;
    CREATE OR REPLACE TRIGGER u_personne_oracle_tr
    INSTEAD OF UPDATE on personne_oracle
    BEGIN
    UPDATE Person SET
    Person.FirstName = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/FIRSTNAME/text()'),
    Person.LastName = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/LASTNAME/text()'),
    Person.Weight = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/WEIGHT/text()'),
    Person.Height = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/HEIGHT/text()')
    WHERE Person.Id = extractvalue(:new.sys_nc_rowinfo$,'/PERSON/ID');
    END;
    UPDATE personne_oracle x
    SET value(x) = updateXML(value(x), '/PERSON/FIRSTNAME/text()','Fred')
    WHERE extractValue(value(x), '/PERSON/ID') = 4;
    ORA-24358: OCIBindObject not invoked for a Object type or Reference
    please help me !

    What happens if you move the view to the remote db?
    and create a synonym for the view on the local?it doesn't work !
    >
    alternatively,
    what happens if you modify from person@oraclelink in
    the create or replace view personne_oracle?it doesn't work !
    The problem is the dblink ! Without it it's work !
    thx for your answer.

  • How to update schema-base xmltype by dba?error ORA-19007

    Hi ,
    Connect to db using user 'u1', register schema to LOCAL and update schema-base xmltype success. Then I login in db as dba, update xmltype occus ORA-19007. If I register the schema to GLOBAL, using dba to update xmltype has no problem. But how to update schema-base xmltype who's schema is register as LOCAL by dba?
    connect to db using user ‘U1’:
    declare
    begin
    dbms_xmlschema.registerSchema(
    'http://www.oradev.com/myschetest.xsd',
    '<schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.oradev.com/myschetest.xsd"
    xmlns:sch="http://www.oradev.com/myschetest.xsd"
    version="1.0" elementFormDefault="qualified">
    <element name = "Employee">
    <complexType>
    <sequence>
    <element name = "EmployeeId" type = "positiveInteger"/>
    <element name = "FirstName" type = "string"/>
    <element name = "LastName" type = "string"/>
    <element name = "Salary" type = "positiveInteger"/>
    </sequence>
    </complexType>
    </element>
    </schema>',TRUE, TRUE, FALSE, FALSE);
    end;
    SCHEMA register as LOCAL.
    create table globtest(id number, content sys.xmltype)XMLTYPE content STORE AS OBJECT RELATIONAL XMLSCHEMA "http://www.oradev.com/myschetest.xsd" ELEMENT "Employee";
    It's OK.
    insert into globtest values(1, sys.XMLType.createXML('<Employee xmlns="http://www.oradev.com/myschetest.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oradev.com/myschetest.xsd http://www.oradev.com/myschetest.xsd"><EmployeeId>1234</EmployeeId><FirstName>Ravi</FirstName><LastName>Murthy</LastName><Salary>100</Salary></Employee>'));
    It's OK.
    update U1.globtest set content = sys.XMLType.createXML('<Employee xmlns="http://www.oradev.com/myschetest.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oradev.com/myschetest.xsd http://www.oradev.com/myschetest.xsd"><EmployeeId>1234</EmployeeId><FirstName>'||unistr('\0080\0081')||unistr('\0085')||'Ravi</FirstName><LastName>Murthy</LastName><Salary>100</Salary></Employee>') where id=1;
    It's OK.
    but when i login in as dba,
    using above update sql. It has probleam.ORA-19007.
    How can i using dba to update this LOCAL schema-base xmltype? Thanks a lot.

    User 'U1' is created by:
    create user u1 identified by u1;
    grant dba to u1;
    Is there any other privilege need to be grant to u1?

  • Update query for XMLTYPE column

    Hello everyone,
    I have inserted xml data into XMLTYPE column of my table,xml data is something like this
    <Data type="FYI">                         
    <ID xmlns="http://orcl.com">T-1-1</ID>
    <Category>FRAME</Category>
    <ProductID>1</ProductID>
    <Name xmlns="http://orcl.com">Frame </Name>
    <Type>BASIC</Type>
    <Code>INSTALL</Code>
    <NodeID>1</NodeID>
    </Data>
    Now i need to update the values inside the <Data> element,like
    ID == T-2-2
    Category == IFRAME
    ProductID == 1.1
    Name == IFRAME
    We are using oracle 10g R2.
    Please help me out how to update. It would be very thankfull for your valuble suggestions
    Thanks in advance

    <Services>
    <DataService type="FRLY">
    <ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
    <CategoryCode>FRAME</CategoryCode>
    <ProductOfferingID>1</ProductOfferingID>
    <Name xmlns="http://www.openapplications.org/oagis/9">Frame Relay</Name>
    <SubType>FRLY - BASIC</SubType>
    <ActionCode>INSTALL</ActionCode>
    <NodeID>1</NodeID>
    <Contract>
    <ID xmlns="http://www.openapplications.org/oagis/9" schemeName="Networx Universal">00000</ID>
    <Category name="Contract Type">U</Category>
    </Contract>
    <Contract>
    <Type xmlns="http://www.openapplications.org/oagis/9">Routine</Type>
    </Contract>
    <CustomerParty>
    <Location/>
    </CustomerParty>
    <ProvisioningStatus type="BillingSetup">
    <Description xmlns="http://www.openapplications.org/oagis/9">C</Description>
    </ProvisioningStatus>
    <MileStone>
    <ID xmlns="http://www.openapplications.org/oagis/9">CWD</ID>
    <Date>2007-01-29</Date>
    </MileStone>
    <ActivityStatus>
    <Code xmlns="http://www.openapplications.org/oagis/9" name="DueDate"/>
    <EffectiveDateTime xmlns="http://www.openapplications.org/oagis/9">2007-01-29T00:00:00Z</EffectiveDateTime>
    </ActivityStatus>
    <AssociatedIDs>
    <ID xmlns="http://www.openapplications.org/oagis/9">1</ID>
    </AssociatedIDs>
    <AssociatedIDs>
    <TemporaryID schemeName="OPKEY">34908</TemporaryID>
    </AssociatedIDs>
    <Location>
    <ID xmlns="http://www.openapplications.org/oagis/9">T-510092</ID>
    </Location>
    <OrderID>RequestID</OrderID>
    <Accessory>
    <ActionCode>ADD</ActionCode>
    <Description xmlns="http://www.openapplications.org/oagis/9">IBM ESERVER-XSERIES306</Description>
    <CategoryCode>5</CategoryCode>
    <InstallVendorParty>
    <Name xmlns="http://www.openapplications.org/oagis/9">MCI</Name>
    </InstallVendorParty>
    </Accessory>
    <Circuit>
    <ID xmlns="http://www.openapplications.org/oagis/9">T-1-1-FRLY</ID>
    <AssociatedIDs/>
    </Circuit>
    </DataService>
    </Services>
    This was my xml which i have inserted into DB for the column XMLTYPE.Now i need to update few values in this whole file like values of
    ID under<DataService>
    Name under <DataService>
    ID under <Contract>
    Description under <ProvisioningStatus>
    i was using the UPDATEXML query to update those it's saying i row updated but when i extract it says null.
    Please help me out to solve this problem.
    Thanks in advance.

  • JDBC XMLType Insert/Update Performance

    I am writing a backend Java EE application that inserts or updates XML documents into a table backed by XMLType.  I'm using Oracle 11.2.0.3 with associated drivers and XDK, with connections obtained from an oracle.jdbc.poo.OracleDataSource.  Unfortunately, I can't get my application to perform faster than 7 transactions a second, with or without JDBC batching.  I've tried several different table structures; here are the two that have shown the most promise:
    CREATE TABLE mrbook_raw
      id  RAW(16),
      created_date TIMESTAMP,
      last_modified_ts TIMESTAMP,
      bk_typ_cd VARCHAR2(16),
      bk_invt XMLType,
      PRIMARY KEY(id),
      FOREIGN KEY (id) REFERENCES mrbook(id)
    ) XMLTYPE COLUMN bk_invt ELEMENT "http://www.mrbook.com/BookData/Vers1#BK_INVT";
    --Also tried the below...
    CREATE TABLE book_master OF XMLTYPE
    XMLTYPE STORE AS SECUREFILE BINARY XML
    VIRTUAL COLUMNS
      isbn_nbr AS ( XmlCast(
                    XmlQuery('declare namespace plh="http://www.mrbook.com/BookData/Vers1/Header";
                              declare namespace bk_invt="www.mrbook.com/BookData/Vers1/InventoryData";
                              /bk_invt:BK_INVT/plh:HDR/plh:ISBN_NBR'
                              PASSING object_value RETURNING CONTENT) AS VARCHAR2(64)) ),
      book_id AS ( XmlCast(
                    XmlQuery('declare namespace plh="http://www.mrbook.com/BookData/Vers1/Header";
                              declare namespace invtdata="http://www.mrbook.com/BookData/Vers1/InventoryData";
                              /bk_invt:BK_INVT/plh:HDR/plh:BOOK_ID'
                              PASSING object_value RETURNING CONTENT) AS VARCHAR2(64)) )
    Here is the code that inserts into the first table:
        private static final String INS_MRBOOK_RAW =
                "INSERT INTO MRBOOK_RAW " +
                        "(id, bk_invt, last_modified_ts, created_date) " +
                "VALUES (?, ?, ?, ?)";
        private static final String UPD_MRBOOK_RAW =
                "UPDATE MRBOOK_RAW " +
                "SET " +
                    "bk_invt = ?, " +
                    "last_modified_ts = ? " +
                "WHERE id = ?";
    protected void updateBookRaw(BookRecord record, Connection con)
            PreparedStatement stmt = null;
            SQLXML sqlxml = null;
            Timestamp now = new Timestamp(System.currentTimeMillis());
            try
                stmt = con.prepareStatement(UPD_MRBOOK_RAW);
                sqlxml = con.createSQLXML();
                DOMResult result = sqlxml.setResult(DOMResult.class);
                result.setNode(record.getExistingInvtData());
                stmt.setSQLXML(1, sqlxml);
                stmt.setTimestamp(2, now);
                stmt.setBytes(3, record.getId());
                stmt.executeUpdate();
            catch(SQLException e)
                throw new RuntimeException(e);
            finally
                if(sqlxml != null)
                    try
                        sqlxml.free();
                    catch(SQLException e)
                        log.error("Unable to free SQLXML!", e);
                if(stmt != null)
                    try
                        stmt.close();
                    catch(SQLException e)
                        log.error("Unable to close statement!", e);
        protected void insertBookRaw(BookRecord record, Connection con)
            PreparedStatement stmt = null;
            SQLXML sqlxml = null;
            Timestamp now = new Timestamp(System.currentTimeMillis());
            XMLDocument bookDoc = parser.getInvtDataDoc(record.getNewBook());
            try
                stmt = con.prepareStatement(INS_MRBOOK_RAW);
                sqlxml = con.createSQLXML();
                DOMResult domResult = sqlxml.setResult(DOMResult.class);
                domResult.setNode(bookDoc);
                stmt.setBytes(1, record.getId());
                stmt.setSQLXML(2, sqlxml);
                stmt.setTimestamp(3, now);
                stmt.setTimestamp(4, now);
                stmt.executeUpdate();
            catch(SQLException e)
                throw new RuntimeException(e);
            finally
                if(sqlxml != null)
                    try
                        sqlxml.free();
                    catch(SQLException e)
                        log.error("Unable to free SQLXML object!", e);
                if(stmt != null)
                    try
                        stmt.close();
                    catch(SQLException e)
                        log.error("Unable to close statement!", e);
    I've tried every storage method possible; CLOBs, Binary XMLType, and structured storage, but I just cannot get the application to go faster than 7 records/second.
    I understand that this may or may not be an XMLType question, but I don't know where to start.  From everything above, it looks like I should be getting good performance inserting and updating XMLType records; and I do indeed get pretty good performance from retrieval, but not from insert or update.  Does anyone have any suggestions on what I might try or a reference I might look at to start?

    Perhaps a more specific question... should I use PreparedStatements with SQLXML or should I use the OracleXMLSave class?  Are SQLXML types batchable under Oracle?

  • Correct way to handle updates of XMLtype columns in standard tables.

    Hello to whoever may read this,
    I am currently studying the XML functionality of oracle DB for a uni project.
    We have been asked to compare/contrast solutions to publishing product and price data for data stored in standard relational tables, and data stored in XML type tables. For extra marks, i am looking at a table containing an XMLType column for multiple items of data relating to the primarykey.
    I have managed to get my head around publishing the data - pretty straight forward, but we have also been asked to show how we can update data, which isn't a problem within the standard tables/columns, but when it comes to the XMLType columns/tables, i dont have a clue.
    At the moment i am working on trying to update an XMLtype column. The table itself is a "product" table, and contains product information, as well as an XMLType column containing multiple changes to the prices. In the relational tables, this "product" table has a one-to-many link to another table called price_history which contains details about past prices (which is populated by a trigger on update/insert of a new price). But in this table all the product changes are stored in XML format in the XML type column "prices".
    Table columns: id number(4), name varchar2(25), prices xmltype;
    example data: 1781, CDW 20/48/E, <product_prices><price_change>
    <change_id>1</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price increased</details>
    <new_value>234</new_value>
    </price_change>
    <price_change>
    <change_id>2</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price increased</details>
    <new_value>235</new_value>
    </price_change></product_prices>
    We need to give examples of an update. I have been looking around the net, and these forums for a solution now for about 4 hours. My own thoughts are that to update this with a new price change i need to, SELECT the current data INTO a variable, then concatenate that variable with the new price change info e.g.
    <price_change>
    <change_id>3</change_id>
    <date_changed>2009-10-13</date_changed>
    <details>price decreased</details>
    <new_value>230</new_value>
    </price_change>
    then insert that whole chunk of data again to overwrite the old data.
    Now im fairly certain there is some function somewhere which will allow me to do this update/insert operation without going through this process... After i am done with this update of XMLType column data, i need to tackle updating data in an XMLType Table with XQuery(? apparently), so if you have any pointers for that please let me know.
    Could one of you experts point me in the right direction for this? Any advice at this stage is a great help and will stop me losing my mind.
    p.s. im sorry about the lengthy description of the problem/solution required. How to describle something i dont understand? I ask myself.

    Hi,
    You really need to take a look at the XMLDB Developers guide.
    For updating XML with SQL/XML see UPDATEXML and for XQuery see [Using XQuery with Oracle XMLDB|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb_xquery.htm#sthref1673]
    HTH,
    Chris

  • Updating a very large xmltype table in xmldb

    Hi,
    I am working on storing a large collection of xml files inside XMLDB (Oracle 10g database). I choose to use the object-relational storage instead of CLOB storage because of the type of queries that have to be performed on this database. The files were loaded successfully into an xmltype table and currently there are more than15million records in the database. I have built functional indexes and text index to improve query performance.
    I would like to know the best way to run regular updates on this database(about once in every two weeks). The update xml files(Five 40MB files with 10,000 records each) contain both old records to be updated and new records to be inserted.
    Each record has a unique id element which can be used in checking to see if it already exists in the database. So the update procedure would require a select on the database to check and see if the record already exists and then update if it exists or insert if it does not.
    Any ideas on how to acheive this within a reasonable amount of time will be greatly appreciated.
    Thanks,
    Uma

    Thanks Mark,
    I have modified the SAXLoader to use a stored procedure inside Oracle which would insert/update as the case may be. It's taking 10 minutes to load a single update file (50MB in size with 10,000 xml records). I have built a text index on this table and it takes 20 to 30 minutes to synchronize the index. I am relatively new to XMLDB and text indexing, and was wondering if there's a way to speed up this process.
    Thanks once again,
    Uma

  • Update multiply nodes on XMLType field

    Hello to all.
    I have this table
    +"DOCUMENT"+
    +(+
    +"ID" NUMBER NOT NULL ENABLE,+
    +"ID_ARCHIVE" NUMBER NOT NULL ENABLE,+
    +"USERNAME" VARCHAR2(20 BYTE),+
    +"CREATION_DATE" DATE,+
    +"LAST_UPDATE" DATE,+
    +"LAST_USERNAME" VARCHAR2(20 BYTE),+
    +"VISIBLE" NUMBER,+
    +"STATE" VARCHAR2(20 BYTE),+
    +"XML" "SYS"."XMLTYPE" ,)+
    This is an example of XML value:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <fields>
    <field fieldId="text_141536485" iterable="true" type="text" specification="simple" name="tiolo" value="1" required="false" status="ok" searchable="true" isField="true" isIterate="false"/><field fieldId="comp_1235813718" iterable="true" type="composite" specification="composite" status="ok" searchable="true" isField="true" isIterate="false">
    <fields>
    <field fieldId="text_-1661573009" iterable="true" type="text" specification="simple" name="New" value="1" required="false" status="ok" searchable="true" isField="true" isIterate="false"/>
    <field fieldId="text_-1661573009" iterable="true" type="text" specification="simple" name="New" value="2" required="false" status="ok" searchable="true" isField="true" isIterate="true"/>
    </fields>
    </field>
    <field fieldId="comp_1235813718" iterable="false" isIterate="true" type="default" specification="default" status="ok" isField="true">
    <fields/>
    </field>
    </fields>
    </root>
    Id like to update the attribute name of all fields whit fieldId="text_-1661573009" to, ie, 'Counter'
    I try this query:
    SELECT d.XML.extract('//field')  from DOCUMENT d
    *where d.XML.existsNode('//field[@fieldId="text_-1661573009"]')=1;*
    it returns all fields with fieldId="text_-1661573009"
    The update:
    update document d set .OBJECT_VALUE = d.XML.updateXML(OBJECT_VALUE,'//field/@fieldId','Counter')
    *where d.XML.existsNode(OBJECT_VALUE,'//field[@fieldId="text_-1661573009"]')=1;*
    I receive this error:
    Errore SQL: ORA-00904: "OBJECT_VALUE": invalid identifier
    *00904. 00000 - "%s: invalid identifier"*
    Somebody could help me to find the error?
    Thank you very much!
    Cristian

    Hi,
    I try this query:
    SELECT d.XML.extract('//field')  from DOCUMENT d
    *where d.XML.existsNode('//field[@fieldId="text_-1661573009"]')=1;*
    it returns all fields with fieldId="text_-1661573009"Actually, it returns all fields of a document where exists at least one field with fieldId "text_-1661573009".
    That will make a difference with updateXML, because it won't update the nodes you're expecting.
    I receive this error:
    Errore SQL: ORA-00904: "OBJECT_VALUE": invalid identifier
    00904. 00000 - "%s: invalid identifier"OBJECT_VALUE is only used to reference the column of an Object Type table, such as an XMLType table.
    Here, you're dealing with a regular table, so use the proper column name, ie "XML".
    Is this what you want to do :
    UPDATE document d
    SET d.xml = updateXML( d.xml,
                           '//field[@fieldId="text_-1661573009"]/@name',
                           'Counter' )
    WHERE d.xml.existsNode('//field[@fieldId="text_-1661573009"]') = 1
    ;?

  • Update XMLType column via VIEW raise ORA-01733 :(

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    I have table "DOCUMENTS" with XML_Info XMLType column.
    I created view "DOCUMENTS2" as select * from "DOCUMENTS",
    after, if I
    update "DOCUMENTS" set XML_Info = XMLType(blah....) -> then all ok, but if I
    update "DOCUMENTS2" set XML_Info = XMLType(blah...) -> Then I got ORA-01733 :(
    Whassup, folks? ;)
    P.S. Sorry for grammar.
    P.S.S PL/SQL in Oracle Forms 6i do not know anything about sys.xmltype :(

    I want to basically copy the data from my local instance to the remote instanceone workaround would be converting xmltype to clob with getClobVal() and then splitting (dbms_lob.substr() ) this clob into smaller chunks and inserting those chunks into some remote table and then in the remote database you join these chunks back together.
    Ants

  • Insert & update XMLTYPE

    Hi,
    I would insert data's into xmltype field using a framwork where I dont't get an instance of OracleConnection.
    Is it possible to do it as CLOB, get an instance of CLOB with a select like:
    insert into test_cocoon values (?,empty_clob())
    then
    select message FROM test_cocoon where id=? FOR UPDATE
    etc...
    with clob it work fine but with xmltype I got an exception.
    Thanks for your help
    Willy

    Perhaps a more specific question... should I use PreparedStatements with SQLXML or should I use the OracleXMLSave class?  Are SQLXML types batchable under Oracle?

  • Updating an xmltype table

    hi,
    I have two xmltype tables(eg. testTableSB and testTableNSB), first one is schema-based(conforms to schemaA) and the other one is non-schema-based.
    So the default storage will be object-relational and CLOB respectively.
    I load the same xml document in both the tables. Each table has one row only(suppose).
    Later I use the update statement with updateXML() in RHS as following:
    update testTableSB x
    set value(x)=updatexml(value(x),'/Company/Person[2]/@Degree','PHD');
    update testTableNSB x
    set value(x)=updatexml(value(x),'/Company/Person[2]/@Degree','BA');
    Both updates work. From the documentation, I came to know that in the first table it only updates the node or attribute value whereas in the second update, the whole document is repalced because it is CLOB based.
    My confusion is in the second update since it seems updating (in this case) only the attribute value.
    Please suggest.
    One more question, how to check whether the storage option for the table is object-relational or CLOB. One option is to describe the table. In this way, it gives info for object-relational only not for CLOB. what is the other way to check it? Any data_dictionary table?
    SQL> create table testTableNSB of XMLType;
    Table created.
    SQL> describe testTableNSB;
    Name Null? Type
    TABLE of XMLTYPE
    Thanking in advance.

    Hi
    I as wrote I never tested this possibility... therefore I did the following test.
    A table contains the following XML data:
    SQL> select extract(value(o), '/optw/person')
    2 from optw1_or_ot o
    3 where existsnode(value(o), '/optw/person[@id=5]') = 1;
    EXTRACT(VALUE(O),'/OPTW/PERSON')
    <person id="5">
    <lastname>String</lastname>
    <firstname>String</firstname>
    <sex>F</sex>
    </person>
    If I access the underlying structure, the query looks like this (notice that birthday is NULL):
    SQL> select x.id, x.lastname, x.firstname, x.birthday, x.sex
    2 from optw1_or_ot o, table(o.xmldata.persons) x
    3 where x.id = 5;
    ID LASTNAME FIRSTNAME BIRTHDAY SEX
    5 String String F
    If I update the data, it seams to work...
    SQL> update table(select o.xmldata.persons
    2 from optw1_or_ot o, table(o.xmldata.persons) x
    3 where x.id = 5) t
    4 set t.birthday = sysdate;
    1 row updated.
    SQL> select x.id, x.lastname, x.firstname, x.birthday, x.sex
    2 from optw1_or_ot o, table(o.xmldata.persons) x
    3 where x.id = 5;
    ID LASTNAME FIRSTNAME BIRTHDAY SEX
    5 String String 06-FEB-04 F
    But if I select the XML data again, the data isn't available...
    SQL> select extract(value(o), '/optw/person')
    2 from optw1_or_ot o
    3 where existsnode(value(o), '/optw/person[@id=5]') = 1;
    EXTRACT(VALUE(O),'/OPTW/PERSON')
    <person id="5">
    <lastname>String</lastname>
    <firstname>String</firstname>
    <sex>F</sex>
    </person>
    It seams that Oracle also stores "control" information in another columns.
    Therefore the only way to add such an element is through the updatexml() function.
    Chris

  • Ora-21700 when updating xmltype column of a table

    Hello,
    Can somebody explain why the following statement gives ora-21700 (object does not exist or is market for delete):
    update translation_message
    set translationxml = XmlType(
    '<NPSREPLY DOMAIN="SWI" OBJECT="SUBSCRIBER" REQUEST="DELETE" RETURNCODE="0" RETURNTYPE="NONE" STATUS="STORED" xmlns="http://saly.bc/nps/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://saly.bc/nps/ NPS_Reply.xsd">
    <SUBREQUEST SEQUENCE="1">
    <ProfileData>
    <ACTION SUBTYPE="PSTN">DEL_CNA_FREE</ACTION>
    <DN>999999999</DN>
    <RETURNCODE>0</RETURNCODE>
    </ProfileData>
    </SUBREQUEST>
    </NPSREPLY>'
    where id = 1926938
    remark:
    when changing
    xsi:schemaLocation="http://saly.bc/nps/ NPS_Reply.xsd
    in
    xsi:schemaLocation="http://saly.bc/nps/NPS_Reply.xsd
    the select is running well.
    I will explain my problem a little bit more:
    The exact oracle error is:
    ora-21700 object does not exist or is marked for delete ORA-06512: at "SYS.XMLTYPE".
    The following peace of xml causes the problem:
    xsi:schemaLocation="http://saly.bc/nps/ NPS_Reply.xsd"
    The statement is running fine if you remove the blank after
    "/nps/ NPS_Repy". So if you use this peace of xml xsi:schemaLocation="http://saly.bc/nps/NPS_Reply.xsd", the statement works fine.
    My question: Wy is the blank not allowed in this peace of xml xsi:schemaLocation="http://saly.bc/nps/ NPS_Reply.xsd"
    The purpose of the blank is to indicate that 'NPS_Reply.xsd' will be located somewhere in "http://saly.bc/nps/". So it can be that 'NPS_Reply.xsd' is found directly under "http://saly.bc/nps/" or some levels lower. According XML standards, the blank is allowed for this purposes.
    regards, Els

    Hi,
    This schema location is only indicative and not used. The xml is generated by an other application and has to be stored in an xmltype column.
    regards, Els

  • Updating the whole xml file in  XMLType column

    Hi ,
    I am facing the problem in updating the XMLTYPE column.
    I need to update the whole xml file
    This is my table
    SQL> desc EMPJAL_TABLE;
    Name Null? Type
    EMPLOYEEID NOT NULL VARCHAR2(140)
    EMPCOM VARCHAR2(100)
    EMPJAL SYS.XMLTYPE(XMLSchema "www.EMPSIM.com" Element "EMPJAL") STORAGE
    Object-relational TYPE "EMPJAL_T"
    I am able to form the CLOB object and trying to use this sql command
    UPDATE EMPJAL_TABLE SET EMPJAL = XMLType( ? ) ) WHERE EMPLOYEEID ='emp1234';
    Here I want to update the whole xmlfile in XMLTYPE column.
    Error is - ORA-00933: SQL command not properly ended
    Please advise
    Thanks
    Govinds

    Hi Mark,
    I apologise for this mistake. I am really putting lot of efforts and also worked/working in advance topics of XML DB.
    Yes I am extensively using Oracle 10g r2 and suggesting others to use this
    This time I had put more effort before posting ,I had a series of queries to resolve most of then were working , this was the one giving problem inside my java code
    I am sorry for this .
    Any how I made another query which works better.
    Thanks
    Govinda

  • Update XMLType

    Hi
    I have an xmltype column, which includes lot of nodes with name & value attributes
    e.g. <xml>
         <node name=”node1” value=”val1”/>
         <node name=”node2” value=”val2”/>
         <node name=”node3” value=”val3”/>
    </xml>
    Can I replace all values with TRIM of the existing values in one update statement? How?
    (I tried to use UPADTEXML, but since number of nodes is dynamic, I had to do UPDATEXML for each node…)
    Thanks!

    Unless I'm missing something MSFT are making it unecessarily complex by not implementing the SQL/XML standard...
    SQL> alter table emp add ( emp_xml xmltype)
      2  /
    Table altered.
    SQL> update emp set emp_xml = XMLELEMENT("EMPLOYEE",xmlattributes(EMPNO as "id"), XMLElement("Name",ENAME))
      2
    SQL> /
    14 rows updated.
    SQL> set pages 0
    SQL> select EMPNO, EMP_XML from EMP
      2  /
          7369
    <EMPLOYEE id="7369">
      <Name>SMITH</Name>
    </EMPLOYEE>
          7499
    <EMPLOYEE id="7499">
      <Name>ALLEN</Name>
    </EMPLOYEE>
          7521
    <EMPLOYEE id="7521">
      <Name>WARD</Name>
    </EMPLOYEE>
          7566
    <EMPLOYEE id="7566">
      <Name>JONES</Name>
    </EMPLOYEE>
          7654
    <EMPLOYEE id="7654">
      <Name>MARTIN</Name>
    </EMPLOYEE>
          7698
    <EMPLOYEE id="7698">
      <Name>BLAKE</Name>
    </EMPLOYEE>
          7782
    <EMPLOYEE id="7782">
      <Name>CLARK</Name>
    </EMPLOYEE>
          7788
    <EMPLOYEE id="7788">
      <Name>SCOTT</Name>
    </EMPLOYEE>
          7839
    <EMPLOYEE id="7839">
      <Name>KING</Name>
    </EMPLOYEE>
          7844
    <EMPLOYEE id="7844">
      <Name>TURNER</Name>
    </EMPLOYEE>
          7876
    <EMPLOYEE id="7876">
      <Name>ADAMS</Name>
    </EMPLOYEE>
          7900
    <EMPLOYEE id="7900">
      <Name>JAMES</Name>
    </EMPLOYEE>
          7902
    <EMPLOYEE id="7902">
      <Name>FORD</Name>
    </EMPLOYEE>
          7934
    <EMPLOYEE id="7934">
      <Name>MILLER</Name>
    </EMPLOYEE>
    14 rows selected.
    SQL>

Maybe you are looking for

  • Publish, deploy, jndi tree

    Hello, I work with Weblogic server 9.2 and Ganymede 3.4. Here are some beginner questions: Why do I, in Ganymede's server tab, publish on the server node instead of on the EAR node? When I publish my EAR I cannot see anything added in the jndi tree o

  • Can Apple TV be used in Cayman Islands?

    Hi, I want to purchase Apple TV but before I do, I want to know if the subscriptions such as Netflix and HBO are available to users in Cayman Islands. Thanks!

  • Budget entry documents with wrong Budget hierarchy doc

    Hello Colleagues ! I have this opened question from a customer: ====================================================== Hello! We have implemented FM- Former management module in SAP Enterprise system. We have problem with budget documents after budge

  • SIM card tray

    Can I take out my SIM card tray while my phone is turned on? Or does it need to be turned off?

  • Need information regarding IDOC to JDBC Scenarios.

    Hi, Kindly help me with the pre-requisites inorder to start with a scenario of IDOC to JDBC and also the scenario of JDBC to IDOC. Regards, Sreedhar, Av