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
;?

Similar Messages

  • How to get node value of XML file from XMLTYPE field of databases

    Hi,
    I want to select node value of XML from XMLTYPE field of oracle db into java code.
    Feel free to answer me if you have any idea about it.
    Thanks

    For XMLType refer
    http://www.oracle.com/oramag/oracle/01-nov/o61xml.html
    http://www.lc.leidenuniv.nl/awcourse/oracle/appdev.920/a96620/xdb04cre.htm

  • How to update xmltype field in the table

    hi
    I have table in DB which contains xmltype field. When I am dragging this table by wizard on a panel and run my project I cannot edit any field in this table and save its data it shows an error. But when I am not using xmltype field in a table then my program runs well.
    How can I fix this proble?

    repost

  • Browsing in XMLTYPE field.

    Hi,
    I've inserted XML into an XMLTYPE field in an ORACLE table.
    Here's the data:
    <NewDataSet>
    <PRINT_ERROR_LIST>
    <CENTRAL_PRINTING_BATCH_ID>123</CENTRAL_PRINTING_BATCH_ID>
    <ENVELOPE_ID>2</ENVELOPE_ID>
    <FAILURE_REASON_CODE>hello world</FAILURE_REASON_CODE>
    </PRINT_ERROR_LIST>
    <PRINT_ERROR_LIST>
    <CENTRAL_PRINTING_BATCH_ID>124</CENTRAL_PRINTING_BATCH_ID>
    <ENVELOPE_ID>3</ENVELOPE_ID>
    <FAILURE_REASON_CODE>hello world</FAILURE_REASON_CODE>
    </PRINT_ERROR_LIST>
    <PRINT_ERROR_LIST>
    <CENTRAL_PRINTING_BATCH_ID>125</CENTRAL_PRINTING_BATCH_ID>
    <ENVELOPE_ID>4</ENVELOPE_ID>
    <FAILURE_REASON_CODE>hello world</FAILURE_REASON_CODE>
    </PRINT_ERROR_LIST>
    </NewDataSet>
    Now, I want to browse the XML and update a record for each CENTRAL_PRINTING_BATCH_ID, in this case i got 3.
    I'm new to XML, any EASY way in PL/SQL to do this?
    Please Help.

    You can use UPDATEXML. For syntax and example, check here
    http://www.psoug.org/reference/xml_functions.html

  • How to update a People and group field using a sandbox solution

    Hi,
    I am creating a sandbox solution for office 365 and creating a custom form using visual web part, which will allow users to enter data in a custom list.
    And that list also have a user field. I am able to get SharePoint user field on the form (using javascript) which is searching for the user and get a value (working fine).
    Issue: But I am not able to save the user value. Because to save user value I require web, UserID and login name, to construct SPFieldUserValue object or string in "111;#TestUser" format. Moreover that user should be present in
    SiteUserInfoList. 
    I tried web.EnsureUser() but did not work under sanbox solution.
    Can you please provide any pointer or workaround to the problem? I may be missing something here.
    Thanks,
    Himanshu

    Hi,
    According to your description, my understanding is that you want to update the people and group field in Sandbox solution.
    In the sandbox solution, you can still use the web.EnsureUser() function to get the user information, see the thread below:
    EnsureUser in sandboxed solution
    In additional, there is a demo with your similiar requirement for your reference:
    Using the People Picker Control in Sandbox Solutions / Office 365
    Thanks
    Best Regards,
    Jerry Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How can i set a long String to a xmltype field in oracle9i use PHP?

    i can set xml String to xmltype field with:
    $sql_insert_sql = "insert into g_province (p_id,p_regionid,p_provincenameobj,solt)
    values (g_province_q.nextval,'".$_GET['region_id']."',sys.XMLTYPE.createXML('".$xml_con."'),0)";
    but if $xml_con too long,i can not set this content into xmltype fields.
    then , i use :
    <?
    //(tabel_name:articles)DDL; //just for test;
    //create table articles (id number(11),content sys.xmltype);
    //----------This is insert test----------------------------------
    $conn = @OCILogon("in_user","user_in","bigfish");
    $stmt = @OCIParse($conn,"insert into articles (id,content) values(1,xmltype(EMPTY_CLOB())) RETURNING content INTO:CONTENT");
    $clob = @OCINewDescriptor($conn,OCI_D_LOB);
    OCIBindByName($stmt,':CONTENT',&$clob,"1",OCI_B_CLOB);
    OCIExecute($stmt,OCI_DEFAULT);
    if ($clob->save("<root><a>JUST TEST</a></root>")){
    OCICommit($conn);
    echo "Insert succes!";
    else{
    echo "Insert default!";
    //---------------Insert end-----------------------------------------
    //---------------Select start---------------------------------------
    $sql = "select content from articles order by id desc";
    $stmt = @OCIParse($conn,$sql);
    @OCIExecute($stmt,OCI_DEFAULT);
    @OCIFetchInto($stmt,&$rows,OCI_RETURN_LOBS);
    echo "<br>Content is:\"".$rows[0]."\"";
    //---------------Select end-----------------------------------------
    ?>
    run it ,display these errors:
    Warning: ociexecute(): OCIStmtExecute: ORA-22816: unsupported feature with RETURNING clause in /home/www/bigfish/sgtest/testclob.php on line 12
    Warning: save(): OCILobWrite: OCI_INVALID_HANDLE in /home/www/bigfish/sgtest/testclob.php on line 13
    Insert default!
    Content is:""
    Warning: Unknown(): ociclose_session: OCISessionEnd: ORA-00600: internal error code, arguments: [729], [28], [space leak], [], [], [], [], [] in Unknown on line 0
    how can i set long content to xmltype fields??

    geng sun,
    Ora-00600 is an internal Oracle error. You will need to open a tar with Oracle.

  • How can i set a long String to a xmltype field use PHP?

    i can set xml String to xmltype field with:
    $sql_insert_sql = "insert into g_province (p_id,p_regionid,p_provincenameobj,solt)
         values (g_province_q.nextval,'".$_GET['region_id']."',sys.XMLTYPE.createXML('".$xml_con."'),0)";
    but if $xml_con too long,i can not set this content into xmltype fields.
    then , i use :
    <?
    //(tabel_name:articles)DDL; //just for test;
    //create table articles (id number(11),content sys.xmltype);
    //----------This is insert test----------------------------------
    $conn = @OCILogon("in_user","user_in","bigfish");
    $stmt = @OCIParse($conn,"insert into articles (id,content) values(1,xmltype(EMPTY_CLOB())) RETURNING content INTO:CONTENT");
    $clob = @OCINewDescriptor($conn,OCI_D_LOB);
    OCIBindByName($stmt,':CONTENT',&$clob,"1",OCI_B_CLOB);
    OCIExecute($stmt,OCI_DEFAULT);
    if ($clob->save("<root><a>JUST TEST</a></root>")){
    OCICommit($conn);
    echo "Insert succes!";
    else{
    echo "Insert default!";
    //---------------Insert end-----------------------------------------
    //---------------Select start---------------------------------------
    $sql = "select content from articles order by id desc";
    $stmt = @OCIParse($conn,$sql);
    @OCIExecute($stmt,OCI_DEFAULT);
    @OCIFetchInto($stmt,&$rows,OCI_RETURN_LOBS);
    echo "<br>Content is:\"".$rows[0]."\"";
    //---------------Select end-----------------------------------------
    ?>
    run it ,display these errors:
    Warning: ociexecute(): OCIStmtExecute: ORA-22816: unsupported feature with RETURNING clause in /home/www/bigfish/sgtest/testclob.php on line 12
    Warning: save(): OCILobWrite: OCI_INVALID_HANDLE in /home/www/bigfish/sgtest/testclob.php on line 13
    Insert default!
    Content is:""
    Warning: Unknown(): ociclose_session: OCISessionEnd: ORA-00600: internal error code, arguments: [729], [28], [space leak], [], [], [], [], [] in Unknown on line 0
    how can i set long content to xmltype fields??

    geng sun,
    Ora-00600 is an internal Oracle error. You will need to open a tar with Oracle.

  • Error while inserting the value in xmltype field of oracle using ALDSP?

    I am getting the following error, while trying to insert the large xml in the xmltype field of oracle using aldsp service:
    inconsistent datatypes: expected - got CLOB in bea
    But this error does not occur when the input xml is of smaller size.

    Please post the complete error message and stack trace.

  • R4 EA: Error loading a table with an XMLTYPE field

    When I try to view the data in a table with an XMLTYPE field I get the following error in R4 EA Version 4.0.0.12 Build MAIN-12-27.  This works in 2.2 and 3.0.
    oracle.sqldeveloper.migration.application
         Error: Resource not found: ${SCRATCH_COMMAND_ICON}.
    Double clicking on the error opens the EXTENSION.XML file and shows this line:
    <trigger-hooks xmlns="http://xmlns.oracle.com/ide/extension">
      <!-- Add registry here if required -->
      <triggers xmlns:c="http://xmlns.oracle.com/ide/customization">
        <actions xmlns="http://xmlns.oracle.com/jdeveloper/1013/extension">
          <action id="MigrationProject.ApplicationScan">
            <properties>
              <property name="Name">${APPSCAN_TITLE}</property>
              <property name="MnemonicKey">${APPSCAN_TITLE2}</property>
              <property name="SmallIcon">res:${SCRATCH_COMMAND_ICON}</property>
            </properties>
          </action>
        </actions>
    The table has the following definition:
    ID    NUMBER(38,0)    No
    WS_DATA    XMLTYPE    Yes
    WS_SNAPSHOT_ID    NUMBER(38,0)    No
    Any help would be greatly appreaciated.  We have to upgrade to 4.0 because our security team will no longer allow Java 6 on any server or workstation.
    Thanks,
    Steve

    Hi Steve
    Still no response?
    I am having same issue when querying a table with XMLTYPE.
    How is your XMLTYPE stored in the DB, as a CLOB or as a BINARY XML?
    Regards,
    Shaun

  • WebPart is raising the following error "Invalid data has been used to update the list item.The field you are trying to update may be read only"

    I have created a farm solution and then i deploy it to SharePoint server, the code looks as follow, and i use it to update a page info values (as the current page values represents old info):-
    [ToolboxItemAttribute(false)]
    public partial class VisualWebPart1 : WebPart
    // Uncomment the following SecurityPermission attribute only when doing Performance Profiling using
    // the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
    // for production. Because the SecurityPermission attribute bypasses the security check for callers of
    // your constructor, it's not recommended for production purposes.
    // [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
    public VisualWebPart1()
    protected override void OnInit(EventArgs e)
    base.OnInit(e);
    InitializeControl();
    using (SPSite site = new SPSite(SPContext.Current.Site.Url))
    using (SPWeb web = site.OpenWeb())
    SPList list = web.Lists["Pages"];
    web.AllowUnsafeUpdates = true;
    foreach (SPListItem items in list.Items)
    items["Author"] = "SharePoint";
    items["Created"] = "01/08/2014 01:44 PM";
    items.Update();
    list.Update();
    web.AllowUnsafeUpdates = false;
    protected void Page_Load(object sender, EventArgs e)
    but when i try adding this web part to a page i got the following error:-
    Invalid data has been used to update the list item.The field you are trying to update may be read only
    so can anyone advice?

    i only changed lines bitween 
    web.AllowUnsafeUpdates = true;
    and
    web.AllowUnsafeUpdates = false;
    and other parts of code remains without change
    so it will updates all pages in current web
    yaşamak bir eylemdir

  • How to remove target node if source field value is empty SAP PI Mapping

    Hello,
    how to remove target node if source field value is empty in graphical Mapping.
    Like if
    MIddle name in source filed is empty, I would like to eliminate target field from out put XML.
    Thank you
    John

    Hi Jhon,
    If you want to remove all empty tags and you dont to complicate your message mapping, you can use a XSL, after the message mapping,  to remove all the empty tags:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="node()|@*">
            <xsl:copy>
                <xsl:apply-templates select="node()|@*"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="*[not(@*|*|comment()|processing-instruction())
         and normalize-space()='' ]"/>
    </xsl:stylesheet>
    Regards

  • Regarding Updation of Custom info type fields

    Hi All,
               I am new to HR ABAP. Actually, I want to update the custom infotype 3 fields as per my user inputs. I am fetching the data from the PA table acoording to sy-datum falling in the begda, enda limitations. now I am changing the field with new values in the work area. And pass with the following data to the FM.
              But I am getting the error  'No data stored for 9008 in the selected period'. I had seen prvious therads, but could not get how they solved the issue.
             Please provide the inpus for the following code. I had also passed the validity start and end.
        CALL FUNCTION 'HR_INFOTYPE_OPERATION'
          EXPORTING
            infty                  = '9008'
            number                 = pernr
      SUBTYPE                =
      OBJECTID               =
      LOCKINDICATOR          =
      VALIDITYEND            =
      VALIDITYBEGIN          =
      RECORDNUMBER           =
            record                 = wa_pa9008
            operation              = 'MOD'
      TCLAS                  = 'A'
      DIALOG_MODE            = '0'
      NOCOMMIT               =
      VIEW_IDENTIFIER        =
      SECONDARY_RECORD       =
         IMPORTING
           return                 = l_bapireturn
           key                    = bapipakey_tab
    Regards,
    Brijesh Patel

    Can anyone please provide inputs on this???

  • How associating an XMLSchema to an XMLType Field with the database model ?

    How can I precise the XMLSchema to an XMLType Field with the database model ?
    I know how to do it in a SQL Syntax :
    CREATE TABLE xwarehouses (
    warehouse_id NUMBER,
    warehouse_spec XMLTYPE)
    XMLTYPE warehouse_spec STORE AS OBJECT RELATIONAL
    XMLSCHEMA "http://www.oracle.com/xwarehouses.xsd"
    ELEMENT "Warehouse";
    , but we have decided to generate the script with the Jdeveloper database modeler tools, and we don't how to precise this with using this tools ?
    Anyone could help me ?

    I'm not sure that it answers your question but under the tools menu there is an option called register schema with XDB.

  • How to Update Business Place & Sec.Code Field in Posted Document

    Dear All,
    Pls suggest how to update Business Place & Section Code field in documents which are posted without entering Business Place & Section Code. Pls tell me how to achieve this without using Validations & Substitutions. Any table entries can be maintained for this? Kindly guide.
    Regards
    Abhijeet

    Hi,
         Thanks for sending the replay,
         I had already update the Material document through the J1INPP T. code. but it not use for update FI
         Document and i want to update Business Place & Section Code in FI document.
         Please suggest,
    Regards
    Abhijeet

  • How to update the path for a field which is of type textarea

    Hi,
    1.I have multiple record block,i need to update the textarea field in this multi entry block.I have put a for loop to achieve the same,however i'm able to update the path for text field,checkbox,selecttype,but am unable to update the path for field which is of textarea.Please suggest.
    2. Also i have another problem which occurs randomly.although i have record for a button click event in  my property file,button click is not happening during the playback.am getting error asVariable "obj.libraryname.web_button_BTN_1" not found for string:
    please not i have entry for the above button in my property file.
    Please suggest.

    Say i have 5 rows then
    for(int i=1;i<=5;i++){
    String Newpath = updatepath(eval("{{obj.libraryname.web_input_text_fieldname}}"),i)
    web.text_area(Newpath).setText("Text to be set")
    Below function is used to update my path
    public String updatepath(String path,int i) throws exception {
    String FPath = "";
    if(i<2) {
    FPath = path.substring(0, path.indexOf("'", path.lastIndexOf("@id=")+5))+path.substring(path.indexOf("'", path.lastIndexOf("@id=")+5));
    } else {
    FPath = path.substring(0, path.indexOf("'", path.lastIndexOf("@id=")+5))+(i-1)+path.substring(path.indexOf("'", path.lastIndexOf("@id=")+5));
    return Fpath
    anyother way to update path and set the fields in mutiple block is appreciable
    thanks
    Suresh

Maybe you are looking for

  • How to add attachment and export data into MS Access

    Let's say that I use PDF file to capture data from users and import the data to MS Access database (via XML). I wonder if there is a way to let user add attachments in Acrobat Reader and when the data is exported, the attachments are kept separately

  • G4 MDD 1.25ghz motherboard transfer

    If I have a Mac G4 MDD with a 1.25ghz processor, will it work on a Mac with a 1.0ghz motherboard? Thanks

  • Movie editing, what do you think is the best program?

    Free is better of course, as free beer at least. I have an idea for a fun movie, but I never tried anything about. I understood Windows' users tent to use `Moviemaker.' Is there something similar for Arch Linux? I just need to cut movie pieces and pu

  • Setting FCE to Uncontrolled Device

    Hey everyone, I have a Sony GV-D800 Hi8 player. I use it to import my home movies from years ago. I also use it to capture video game footage that I run through it. I cant figure out how to set final cut express into "Un Controlled" mode so it doesn'

  • STO -  Checking rule.

    Hello , How the ATP  influencing the STO delivery ? We have  different checking rule in the configuration , as well as we have checking rule 'B ' for delivery . Which checking rule will be used for delivery creation ? Any SAP help document or OSS not