Update the xml string values.

Hello

I'm on 11.2.0.2 and got table with column nclob that stores the long xml string.

{code}

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

<? Fuego version = "6.5.2" build "101272 =? >

< Game >

< configuration name = "TEST database" type = subtype "SQL" = "DDORACLE" >

< name = "jdbc.pool.idle_timeout property" value = "5" / > "

< name = "jdbc.pool.entry.max property" value = "10" / > "

< name = "oracle.dateEqualsTimestamp property" value = "false" / > "

< name = "jdbc.schema property" value = "user1" / > "

< name = "jdbc.host property" value = "hostname" / > "

< property name = "user" value = "user1" / >

< name = "jdbc.port property" value = "1521" / > "

< name = "jdbc.pool.min property" value = "0" / > "

< name = "jdbc.pool.maxopencursors property" value = "50" / > "

< name = "oracle.sid property" value = "dbsid" / > "

< property name = "password" value = "user101" / >

< name = "jdbc.xa property" value = "false" / > "

< name = "jdbc.pool.max property" value = "10" / > "

< / configuration >

< configuration name = 'TEST base2' type = subtype "SQL" = "DDORACLE" >

< name = "jdbc.pool.idle_timeout property" value = "5" / > "

< name = "jdbc.pool.entry.max property" value = "10" / > "

< name = "oracle.dateEqualsTimestamp property" value = "false" / > "

< name = "jdbc.schema property" value = "user2" / > "

< name = "jdbc.host property" value = "hostname" / > "

< property name = "user" value = "user2" / >

< name = "jdbc.port property" value = "1521" / > "

< name = "jdbc.pool.min property" value = "0" / > "

< name = "jdbc.pool.maxopencursors property" value = "50" / > "

< name = "oracle.sid property" value = "dbsid2" / > "

< property name = "password" value = "user201" / >

< name = "jdbc.xa property" value = "false" / > "

< name = "jdbc.pool.max property" value = "10" / > "

< / configuration >

< / set >

"

{code}

My goal is to update the value of the password so that it is equal to the value of jdbc.schema value < property name = "jdbc.schema" value = "user2" / > in this case user2 | " '01'

< property name = "password" value = "user201" / > <-that's my goal.

Concerning

Greg

Hello

You can find a few methods here: How To: nodes of XML update with values from the same document. Oracle of Odie's blog

They are not applicable to your options and version though.

This is the first applied to your case:

declare

v_xmldoc xmltype.

Start

Select xmlparse (document to_clob (t.xmldoc))

in v_xmldoc

of my_nclob_table t

where t.id = 1;

for r in)

Select idx, schema_name

of my_nclob_table t

xmltable)

"/ game/configuration.

passage v_xmldoc

columns idx for ordinalite

, schema_name varchar2 (30) path 'property[@name="jdbc.schema"]/@value '.

)

)

loop

Select updatexml)

v_xmldoc

, "configuration/game / ['|]» [to_char (r.idx) |'] Property[@name="password"]/@value'

r.schema_name | '01'

)

in v_xmldoc

Double;

end loop;

Update my_nclob_table t

Set t.xmldoc = to_nclob (xmlserialize (dash, document v_xmldoc))

where t.id = 1;

end;

/

Here's another, using DOM:

declare

CLOB doc;

p dbms_xmlparser. Analyzer;

domdoc dbms_xmldom. DOMDocument;

docnode dbms_xmldom. DOMNode;

conf_list dbms_xmldom. DOMNodeList;

conf_node dbms_xmldom. DOMNode;

password_node dbms_xmldom. DOMNode;

schema_name varchar2 (30);

password_value varchar2 (256);

Start

Select to_clob (xmldoc)

in the doc

of my_nclob_table

where id = 1;

p: = dbms_xmlparser.newParser;

dbms_xmlparser.parseClob (p, doc);

domdoc: = dbms_xmlparser.getDocument (p);

dbms_xmlparser.freeParser (p);

docnode: = dbms_xmldom.makeNode (domdoc);

conf_list: = dbms_xslprocessor.selectNodes (docnode, ' / game/configuration ');

for i from 0... dbms_xmldom.GetLength (conf_list) - 1 loop

conf_node: = dbms_xmldom.item(conf_list, i);

dbms_xslprocessor.valueOf (conf_node, 'property[@name="jdbc.schema"]/@value', schema_name);

password_node: = dbms_xslprocessor.selectSingleNode (conf_node, 'property[@name="password"]/@value');

dbms_xmldom.setNodeValue (password_node, schema_name |) '01');

end loop;

dbms_xmldom.writeToClob (domdoc, doc);

dbms_xmldom.freeDocument (domdoc);

Update my_nclob_table t

Set t.xmldoc = to_nclob (doc)

where t.id = 1;

end;

/

Post edited by: odie_63 - added DOM example

Tags: Database

Similar Questions

  • How to store the query string value in the scope of the session in webcenter spaces?

    Hello

    I want to store the query string value (which is given from URL) in the sessionScope variable. According to the value of sessionScope beacause I went some components inside my taskflow. Can someone help me how to store this value in the scope of the session. I use webcenter spaces for my application development.

    Thank you

    Ashok.

    Please see the article below

    How to pass a parameter of argument the query URL to a parameter input workflow? (Doc ID 1545808.1).

  • XML is not displayed as XML (hierarchical format) but as the xml string

    The condition is:

    To retrieve data of a table and are displayed in a table on a page in the ADF. One of the columns in the DB table is a "Type of XML", which stores the XML.  For each record in the table on page ADF, there is a hyper link, clicking on which the XML code must be displayed in a pop-up window.

    There is no problem to display data in the pop-up window.  But the popup does not display the data as a hierarchy XML (wrapping of lines at the end of each element).  It shows that the XML string...

    If someone could help?

    Concerning

    Christiane

    Add a property row to your inputtext to multi line. otherwise, you will never see the brakes of the line.

    Timo

  • Find and replace the delimited string value by the

    Hi all

    I have a requirement where I need to find and replace the delimited string values.

    For example, the string is "GL ~ 1001 ~ 157747 ~FEB-13~ CREDIT ~ A ~ N ~ US ~ NULL ~". The 4th column gives the month and year. I need to replace it with the name of the previous month. For example: "GL ~ 1001 ~ 157747 ~JAN-13~ CREDIT ~ A ~ N ~ US ~ NULL ~". I need to do the same thing for the past 12 months.

    I thought initially divide the values and store it in a variable and then after him substituting the value required, join the return.

    I just wanted to know if there is a better way to do it?

    Like this:

    with a model like

    (select "GL ~ 1001 ~ 157747 ~ FEB-13 ~ CREDIT ~ A ~ N ~ $ ~ NULL ~' double UNION ALL data")

    Select ' GL ~ 1001 ~ 157747 ~ JAN-13 ~ CREDIT ~ A ~ N ~ US ~ NULL ~' double data)

    Select

    REPLACE (DATA, TO_CHAR (to_date (substr (data, 16.6), "MON-RRRR"), 'MON - RR'), TO_CHAR (to_date (substr (data, 16.6), "MON-RRRR")-1, 'MON - RR'))

    modeling;

    GL ~ 1001 ~ 157747 ~ JAN-13 ~ CREDITS ~ HAS ~ N ~ US ~ NOTHING ~

    GL ~ 1001 ~ 157747 ~ DEC-12 ~ CREDITS ~ HAS ~ N ~ US ~ NOTHING ~

    Ishan

  • Select the value of the xml string property where certain conditions

    Hi, I'm on 11.2.0.2 and just started with XPath. "got the string xml like this: [code]"

    "[code] should output jdbc.schema password - User1, User2 user101 user201 tried: select x.schema_name, obpmdir.test x.password t, xmltable ("for $i in property/configuration/set return {$i/@name}' from xmltype (t.fuego_strvalue) schema_name varchar2 columns (1234) PATH 'value', password varchar2 (1234) PATH 'value') x; " has received the error: ORA-19276: XPST0005 - XPath step specifies an invalid element/attribute name: 19276 (value). 00000 - "XP0005 - XPath step specifies an invalid element/attribute name: (%s) ' * Cause: step the XPath specified is not a valid element or the attribute name that does not match all nodes according to the entry or the structure XML schema. * Action: Correct the name of element or attribute name may be misspelled. Regards Greg

    See my first example here in response to your previous question: update the values of string xml.

    BTW, to format your code, go to the so-called 'Advanced Editor ' and choose the formatting that you want in the menu behind the > icon.

    Note that, as of now, none of the available options are really satisfactory to shape the code because he doesn't use fixed-width fonts.

    Personally, I manually change the font "Courier New" and apply the effect 'Quote' for formatting my code snippets, that mimicks a little previous rendering allows us to get through the {code} tags (before the migration of the forum).

  • the form of course update the user field value

    Can experts tell me if we can retrieve the data from the form of courses and update the user field. If so, please could you tell me how to do and a simple example will be useful.

    Thank you very much

    Write an adapter to transfer and pass the value of the form attribute of the user

    How to create a transfer adapter: -.

    Name of the adapter:-adapter task of transfer process
    Adapter type:-treat stains
    Description:-adapter task of transfer process
    Variable:-determination of entry (of Type String) during execution
    Task of the adapter:-logical task... Adapter--> Variable defined return value--> entry
    Save... Build... Compile...
    For example, you have created your adapter generic transfer...

    Suppose that your Mobile is stored in the field of process form Mobile...

    In the process definition, create a task... Set the task to transfer adapter process...

    entry--> process Date--> Mobile
    Return value of--> user definition adapter--> Mobile...

    It is a very convenient way of transmission data Mobile Process to user profile without writing any custom code

    Mark if you find it useful, useful...

  • update the XML name by using sql

    Hello

    IAM using oracle 11g

    create table example (ch. clob);
    insert into a values (sample)
    ? XML version = "1.0"? (> < ABC > < company > < / ABC > < A employee > < name > < / name > < sex > M < / sex > < / employee > < employee > < name > B < / name > < sex > M < / sex > < / employee > < employee > < name > c < / name > < sex > F < / sex > < / employee > < / business > ');

    for example I want to update the 'ABC' to 'CDE' XML element

    ? XML version = "1.0"? (> < company > < ORDER > < / EBR > < A employee > < name > < / name > < sex > M < / sex > < / employee > < employee > < name > B < / name > < sex > M < / sex > < / employee > < employee > < name > c < / name > < sex > F < / sex > < / employee > < / company > ');


    How can I update this XML element name.

    I search the web, I found UPDATEXML it is used to change the value of XML. but I want to display xml name.

    Concerning
    Oracle user

    To start, if you want a pure XML solution, you should really use an XMLType column to store XML data in the first place.
    It allows several types of optimization takes place, according to the model of storage used.
    11 g, I highly recommend the use of binary XML storage (this is the default template from 11.2.0.2).

    IAM using oracle 11g

    What version exactly?

    On 11.2.0.3, you can use XQuery Update Facility:

    SQL> create table sample_data (doc xmltype);
    
    Table created
    
    SQL> insert into sample_data values (
      2  '
      3  
      4   
      5   AM
      6   BM
      7   cF
      8  ');
    
    1 row inserted
    
    SQL> commit;
    
    Commit complete
    
    SQL> set long 500
    SQL> select xmlserialize(document
      2           xmlquery(
      3            'copy $d := /Company
      4             modify rename node $d/ABC as "CDE"
      5             return $d'
      6            passing t.doc
      7            returning content
      8           )
      9           as clob indent
     10         )
     11  from sample_data t
     12  ;
    
    XMLSERIALIZE(DOCUMENTXMLQUERY(
    --------------------------------------------------------------------------------
    
      
      
        A
        M
      
      
        B
        M
      
      
        c
        F
      
    
     
    

    Other solutions of "XML" involve recursive or as mentioned XQuery, XSLT functions:

    SQL> SELECT XMLSerialize(DOCUMENT
      2    XMLTransform(
      3      t.doc
      4    , xmltype('
      5       
      6        
      7          
      8            
      9          
     10        
     11        
     12          
     13            
     14          
     15        
     16      ')
     17    )
     18    AS CLOB INDENT
     19  )
     20  FROM sample_data t
     21  ;
    
    XMLSERIALIZE(DOCUMENTXMLTRANSF
    --------------------------------------------------------------------------------
    
    
      
      
        A
        M
      
      
        B
        M
      
      
        c
        F
      
    
     
    
  • Need help to parse the xml string to populate the drop-down list

    Here is my: problem

    I have a hidden text field that contains the text of an xml

    <>facilities
    < building >
    < name > Building A < / name >
    < name > building B < / name >
    < name > building C < / name >
    < name > building D < / name >
    < name > building E < / name >
    < name > building F < / name >
    < name > building G < / name >
    < name > building H < / name >
    < / build >
    < / facilities >

    My goal is to read this with JavaScript xml string to populate a drop-down list with values of element (name). Does anyone know how script that?

    Attached is a sample .xdp

    See you soon,.

    Jesse

    Here is an example of change. I put the code click on the button, so you can see it in operation... You can place this code in the event that makes sense for you. I also added another field to show the DOM (this is for debugging purposes and you can remove this field if you want).

    Paul

  • Save the alphanumeric string value

    Hello!
    How to save a value to a variable so that I can use it in the future? I have a string of output of a case structure proposed by an OK botton. I want to save the string value when I press the ok botton...
    Thanks in advance
    GM

    Just write the string in a text file.  When you want to use it later, to read the text file.

  • Could not save the different string value to each element of the array

    I have a configuration of VI to read several channels Veristand project.  The entrance is a table 1 d of channels, (an element for each channel, I want to read).  The channels have different names, each of the elements in the chain must be different.  I am able to edit each item and run the VI, and it works fine.  However, if I save, close and reopen the VI, all elements show the same value (what happens to the value of the last element for which I defined a default value).  Is this behavior planned, or have I missed a configuration setting which would allow different string values?  Please notify.  Thank you.

    GSinMN

    Make sure that you select the table and not only one item when you right click-> set by default on the front panel.

  • splitting the query string values

    all,
    I do not remember this, but my problem is that I have a collection of forwarded to my query as string values "X 234234: 23466 X: X 03287: X 457675 ', so my request should be able to divide each data value and use in the filter as below,

    Select * from emp where EmpID in ("X 234234: 23466 X: X 03287: X 457675")

    so, how can I divide each individual value and pass through the filter?

    Thank you.

    SELECT trim(x.column_value.extract('e/text () ')) CLO
    Of
    TABLE (XMLSEQUENCE (XMLTYPE (""
    || REPLACE ('1:2:3:4:6:7:8',': ','
    ')
    || ((("
    ").extract('e/e'))) x

    Try customizing the syntax above using the column in the function replace instead of my hard-coded string and pass it to the filter predicate using an in operator.

    Edited by: Chandrakaanth Ramamurthy on April 25, 2013 16:29

  • Update the XML data store

    Hello experts,

    I've created an interface when an xml file is reversed in the form of a source data store. Xml data are pumped into a target of oracle db. All this goes well.

    I'm creating a scenario where I get an xml file from a ftp server on a daily basis (with agent). This new xml file has the same structure as that already used in the interface. The question is: How can I update the data in the xml data store?

    I tried to replace the original xml file, but it does not work and cdc does not seem to apply here, I searched for quite a while now.

    Thank you very much!

    Yves

    Hello

    See if that helps
    XML for the interface Oracle even insert County regardless of input XML file

    Thank you
    Fati

  • Updating the XML data

    We know how or if you can update or insert new data in an xml file in Flash AS3?

    An example would be a person complete and submit a form, then the input is sent to the xml file to create or update the nodes in the xml file.

    Thanks in advance.

    You can do that directly flash player.

    You can do this via a script server-side, e.g. a script using php that processes the application of flash, but often the data in this type of scenario would be stored in a database instead of an xml file (however you use php to update an xml file is quite possible too)

  • HTTPService read only not update xml, I had manually update the xml code in my browser

    I called a HTTPService (id = data2php) that runs a php script that creates an xml doc and put it on my server. I then called another HTTPService (id = feedRequest) that reads the xml document, then I try to fill a datagrid with the lastResult my HTTPService that reads the xml doc. My question is that the HTTPService that reads the xml doc reads the previous incarnation of the doc xml, not the newly created that created my HTTPService (data2php). I've been manually the xml doc is going in my browser and hit refresh for my HTTPService feedRequest to read the updated xml code.

    Here is the mxml for the httpservice that reads the xml file:
    "" < mx:HTTPService id = "feedRequest" url = " http://cfcdi.org/eric/dashboard/php/sales.xml" result = "feedResult (event)" resultFormat = "xml" useProxy = "false" / > "

    pretty simple.

    (in fact, from time to time it will read the updated)

    N ° dummy Variable like this:

  • Updated the xml file has not reflected in R12

    Hi Experts,

    I modified a file xml under the /mds folder ($header info and its content) and then the apache server and oacore rebounced (using scripts under $INST_TOP/admin/scripts). However, the XML page didn't get reflects the changes, I still see the old version of the file when checking "on this page. I also deleted the cache using the responsibility of functional administrator > Central Services > caching framework > Global Configuration > clear cache


    Anything I missed?

    Very much appreciate your comments.

    You must import the file into the MDS database repository while changes will be carried over on the page.
    XMLImporter allows you to import the file in the database.

Maybe you are looking for