Update the value of the node with particular attribute
HelloOracle 11g
I have a table with the following structure:
create table xml_test (test_id varchar2(12), xml_done xmltype);
The xml_done column uses the following structure (example XML):<meas id="test">
<data-elements>
<data-element id="abc">
<value>1</value>
</data-element>
<data-element id="def">
<value>2</value>
</data-element>
<data-element id="ghi">
<value>3</value>
</data-element>
</data-elements>
</meas>
I have a requirement to update the text in the < value > < / value > based on @attribute of the id in the data < item > which it is. In my code below, I'm updating the 1 value to be 'updated value'. I tried UPDATEXML without success:UPDATE xml_Test SET XML_DONE =
UPDATEXML(XML_DONE,
'/meas/data-elements/data-element/value','updated value')
WHERE extract(xml_done, '/meas/data-elements/data-element/@id') = 'abc'
and test_id = 1;
Any suggestions are appreciated, thank you very much!Published by: chris001 on April 25, 2013 10:14
Hello
The WHERE clause filters the rows in the table, not within the XML document.
You must use an XPath predicate for this.
SQL> create table xml_test (test_id varchar2(12), xml_done xmltype);
Table created.
SQL>
SQL> insert into xml_test (test_id, xml_done)
2 values ('1',
3 xmlparse(document
4 '
5
6
7 1
8
9
10 2
11
12
13 3
14
15
16 ')
17 );
1 row created.
SQL> commit;
Commit complete.
SQL> update xml_test
2 set xml_done =
3 updatexml(
4 xml_done
5 , '/meas/data-elements/data-element[@id="abc"]/value/text()'
6 , 'updated value'
7 )
8 where test_id = '1' ;
1 row updated.
SQL> set long 5000
SQL> set pages 100
SQL> select xml_done from xml_test where test_id = '1';
XML_DONE
--------------------------------------------------------------------------------
updated value
2
3
If you also want to make sure that the line actually contains something to update, use XMLExists in the WHERE clause:
SQL> roll;
Rollback complete.
SQL> update xml_test
2 set xml_done =
3 updatexml(
4 xml_done
5 , '/meas/data-elements/data-element[@id="abc"]/value/text()'
6 , 'updated value'
7 )
8 where test_id = '1'
9 and xmlexists(
10 '/meas/data-elements/data-element[@id=$id]'
11 passing xml_done
12 , 'abc' as "id"
13 )
14 ;
1 row updated.
SQL> select xml_done from xml_test where test_id = '1';
XML_DONE
--------------------------------------------------------------------------------
updated value
2
3
If you are on 11.2.0.3, you can officially use XQuery Update instead.
Tags: Database
Similar Questions
-
How can I update the rubrics with WebServices?
How can I update the rubrics with WebServices?
/Anyone/ has some success with this?
It becomes important to our business objectives in order to solve the problems within the control elements.
I can't enter the number of line by line in order to uniquely identify it. How can I get that number, so I can send it with xml "update"?
A little nudge in the right direction would be much appreciated.
Aaron.
You must use a field on the form as the one on the line items, NOT the line number that appears in the journal of the line item. If I understand correctly, the LineItemIdentifier can be any field on the form, even the short description. It is best if you know you will use web services to update the line items, you add a (potentially hidden) field to the form and fill that with unique values when positions are created. If you are working with existing elements of line, then you must choose a field that will be usually unique within a single record and hope, you don't have a lot of duplicates.
-
Insert/update the column with the clob data type
Hi all
ORCL Version: 11g.
I have a table with the clob data type.
Test12
(col1 clob);
I'm trying to insert/update to update the column with more than 4000 characters.
But due to the limitation of tank 4000, I could not Insert/Update.
Need your help in resolving this issue.
THX
Rod.
The limit of 4000 characters is incorrect. That pertains only to the varchar2 data type. A clob can hold more than 4 G.
Here is an example that shows how to insert it, I found...
Otherwise, here is a way 'dirty' to do.
insert into your_table (COLA, COLB)
values
(PRIMARY_KEY, PART 1 OF DATA)
;
Update your_table
Define COLB = COLB | PART 2 OF BIG DATA
where COLA = PRIMARY_KEY;
Update your_table
Define COLB = COLB | PART 3 OF BIG DATA
where COLA = PRIMARY_KEY;
.. and so on...
I don't know that I personally recommend the second style... But he could do the job.
-
E531 update the Bios with WIndows 10 installed?
Is it possible to update the BIOS with 10 Windows installed on E531?
I don't see W7, W8, and XP
Yet once, have solved this problem, I thought I would share with others who may have the same or similar issues.
I was able to update the BIOS on my Windows 10 install with upgrade download BIOS in Windows 8. Simply install as you normally would, and be patient for the machine to install. Installation BIOS itself is a little funky; I saw the screen go completely white for a while without message about progress or anything like that. But ultimately it ends and works well.
-
I need help to activate my computer but I don't have the code. I bought a computer that has been renovated and the owner said that he has updated the computer with Windows 7, but the computer is now ask for an activation code. I tried to contact the guy but he won't answer. Is it possible to check the activation without the code? I need help and do not want to pay a hundred dollars more.
Is there a COA sticker that is attached to the machine?
If so, check to see what edition and version of Windows machine is licensed to:
COA certificate of authenticity:
http://www.Microsoft.com/howtotell/content.aspx?PG=COA
??
What is the certificate of authenticity for Windows?
http://Windows.Microsoft.com/en-us/Windows7/what-is-the-Windows-certificate-of-authenticity
Also:
Please run the Microsoft Genuine Diagnostics Tool then copy and paste the results into an answer here for further analysis:
http://go.Microsoft.com/fwlink/?LinkId=52012 -
Extract the value of the node with multiple namespace xml
Hello
I have to extract values in xml that includes several namepspaces. a single namespace has value of xmlns. I managed to get the value of the node for tag event where as info tag returns null.
experrts need help.
<? XML version = "1.0" encoding = "utf-8"? >
< event xmlns = " " http://www.w3.org/2001/XMLSchema-instance ' >
< data xmlns = ">
< object >
< eventtype > 110 < / eventtype >
< result > < / result >
< / object > < / data >
< xmlns = info "> < jref > JREF < / jref >
< / info >
< / event >
SELECT
TMX.eventtype,
TMX.result,
TMX.jref
of EXAMPLE_MESSAGES1.
XMLTABLE (XMLNAMESPACES (DEFAULT 'http://www.w3.org/2001/XMLSchema-instance'), )
' for $i in/event/data/object
Returns the local item: r {$i / eventtype,}
$i / result.
{$i / jref}'
EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE
COLUMNS
EVENTTYPE VARCHAR2 (30) PATH "eventtype"
RESULT VARCHAR2 (30) PATH 'result ',.
TMX JREF PATH VARCHAR2 (30) 'jref');
Version of the database is 11.2.0.3.0
Hello
I have to extract values in xml that includes several namepspaces.
There is only one workspace names in fact (the default value).
Normally, an empty xmlns UN-declare a default namespace declaration is inherited from the parent node.
So, in your example, only
node belongs to the default namespace. In this case, when you have to walk through the nodes belonging to some namespaces and others in any namespace, do not use the DEFAULT option in the WITH XMLNAMESPACES.
Instead, declare a prefix and use it as needed for qualify of nodes.
Another thing:
Returns the local item: r {$i / eventtype,}
What what do you want with "local:" here?
The following should give the expected results:
SELECT TMX.*
of EXAMPLE_MESSAGES1
XMLTABLE)
XMLNAMESPACES ("http://www.w3.org/2001/XMLSchema-instance" as "ns0")
, ' / ns0:event'
EXAMPLE_MESSAGES1 OF PASSAGE. XML_MESSAGE
COLUMNS
EVENTTYPE VARCHAR2 (30) PATH 'data, object, eventtype.
, RESULT VARCHAR2 (30) PATH ' object/data/result '.
, PATH of VARCHAR2 (30) JREF ' info/jref.
) TMX;
-
Replacement of the nodes with duplicates
I can't find out how to write an XQuery query which can essentially 'jump' a replacement when I said to. I don't know who makes no sense, so here's a better explanation.
I have an XML file that is stored in an Oracle XML DB that looks like this:
We get the update commands that look like the same thing, with a 'command' attached to add the book to the store or drop:<bookstore> <book title="Analytical Chemistry" publish_date="198710"> <author>... <publisher>.... <etc.> </book> <book title="Particle Physics" publish_date="199202"> <author>... <publisher>.... <etc.> </book> <book title="Applied Biophysics" publish_date="201005"> <author>... <publisher>.... <etc.> </book> </bookstore>
The rule is should I replace or add a book in the store if I have a book of the same title, and the order is "merge", or drop it if the order is to 'drop '. I have a request XQuery Update function now makes what looks like this:<bookstore> <book title="Analytical Chemistry" publish_date="199210"> <order>merge</order> <author>... <publisher>.... <etc.> </book> <book title="Particle Physics" publish_date="199202"> <order>drop</order> <author>... <publisher>.... <etc.> </book> <book title="Chaos Theory" publish_date="199102"> <order>merge</order> <author>... <publisher>.... <etc.> </book> </bookstore>
This works very well for commands like above, but once from time to time, we receive a command like this:declare updating function local:book_merge($old, $book_merge) { for $orderEntr in $book_merge/book let $chgCd := $orderEntr/order let $orderTitle := $orderEntr/@title let $oldBooks := $old/bookstore let $oldBookEntr := $oldBooks/book[@title=$orderTitle] return if( $chgCd = "drop" and exists($oldBookEntr) ) then delete node $oldBookEntr else if( exists($oldBookEntr) ) then replace node $oldBookEntr with $orderEntr else insert node $orderEntr into $oldBooks };
Notice how the first entry is duplicated. In this case, the requirement must only enter the book in the library once. Can someone give me an idea of how I would go about implementing that? I am struggling to understand how to ask the right question, so please forgive me.<bookstore> <book title="Analytical Chemistry" publish_date="199210"> <order>merge</order> <author>... <publisher>.... <etc.> </book> <book title="Analytical Chemistry" publish_date="199210"> <order>merge</order> <author>... <publisher>.... <etc.> </book> <book title="Particle Physics" publish_date="199202"> <order>drop</order> <author>... <publisher>.... <etc.> </book> <book title="Chaos Theory" publish_date="199102"> <order>merge</order> <author>... <publisher>.... <etc.> </book> </bookstore>
You can add a predicate that will filter the next (or previous) duplicates of a given input:
where not($orderEntr/following-sibling::book[@title = $orderTitle])
Full test case:
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> create table tmp_xml of xmltype; Table created. SQL> insert into tmp_xml values ( 2 xmltype('
3 ') 16 ); 1 row created. SQL> var orders clob SQL> begin 2 3 :orders := '4 7XXX 56 8 11YYY 910 12 15ZZZ 1314 4 '; 25 26 end; 27 / PL/SQL procedure successfully completed. SQL> set long 5000 SQL> set pages 100 SQL> SQL> select /*+ no_xml_query_rewrite */ 2 xmlserialize(document 3 xmlquery( 4 'copy $d := $old 5 modify ( 6 for $orderEntr in $orders/bookstore/book 7 let $chgCd := $orderEntr/order 8 let $orderTitle := $orderEntr/@title 9 let $oldBooks := $d/bookstore 10 let $oldBookEntr := $oldBooks/book[@title = $orderTitle] 11 where not($orderEntr/following-sibling::book[@title = $orderTitle]) 12 return 13 if( $chgCd = "drop" and exists($oldBookEntr) ) 14 then delete node $oldBookEntr 15 else if( exists($oldBookEntr) ) 16 then replace node $oldBookEntr with $orderEntr 17 else insert node $orderEntr into $oldBooks 18 ) 19 return $d' 20 passing object_value as "old" 21 , xmlparse(document :orders) as "orders" 22 returning content 23 ) 24 indent 25 ) as result 26 from tmp_xml ; RESULT --------------------------------------------------------------------------------5 9merge 6XXX 7123 810 14merge 11XXX 12123 1315 19drop 16YYY 1718 20 24merge 21ZZZ-2 2223 merge XXX 123 ZZZ merge ZZZ-2 It's another question, you probably already have the answer: I guess you must also remove the
nodes of the newly merged books? -
Problem when executing the processors in the nodes with disabled local storage
Hello world
We test the coherence JSR107 (a.k.a. JCache) implementation of Yannis (https://github.com/yannis666/Coherence-JSR-107) and we found the following issue when you work with a local storage where distributed cache node is disabled (using - Dtangosol.coherence.distributed.localstorage = false). Yannis implementation uses several EntryProcessors for the execution of operations get() or put () in the cache. For example, the following code is used to update a value in the cache:
/ public class PutProcessor implements InvocableMap.EntryProcessor {}
@Override
public Object process (input InvocableMap.Entry) {}
BEntry entry = (BinaryEntry) BinaryEntry;
return bEntry.isPresent ()? bEntry.getBinaryValue (): null;
}
}
And put operatino is taken from the following code:
namedCache.invoke (key, CPU)
where processor argument contains a reference to the PutProcessor object.
When we call JSR107 performs surgery put in the cache and code above we get following exception:
java.lang.NullPointerException
to com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ Storage.invoke (PartitionedCache.CDB:10)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onInvokeRequest(PartitionedCache.CDB:52)
to com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ InvokeRequest.run (PartitionedCache.CDB:1)
at com.tangosol.coherence.component.net.message.requestMessage.DistributedCacheKeyRequest.onReceived(DistributedCacheKeyRequest.CDB:12)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onMessage(Grid.CDB:34)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.onNotify(Grid.CDB:33)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.PartitionedService.onNotify(PartitionedService.CDB:3)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onNotify(PartitionedCache.CDB:3)
at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
at java.lang.Thread.run(Thread.java:662)
Of course we have previously started another node in the cluster with local storage enabled.
It seems that, as no storage card is present at the node, a NullPointerException is thrown when you try to insert the entry.
Could someone give advice on this problem and how to overcome? This implementation is based on the processor is not compatible with the knots of localstorage cache disabled?
Thank you in advance,
Daniel C.Hello
It sounds like COH-7180 - demand deserialization failure results in a cryptic NullPointerException, that has been fixed in one of the 3.7.1 patches. The real problem is that your entryprocessor cannot be deserialized.
-
Update updated the columns with null are excluded from the DB adapter
Hi all
My fusion system interacts with DB2 using the DB adapter.
I have a script that I need to update a flag in the table after completing my bpel workflow. But by updating the value of indicator to "Processsed", there are other columns with a NULL value.
How to solve this problem. I don't want to do, the other columns should not be alerted.
Thank you
Richa
Hello
The issue has been resolved. In fact, I've updated the update statement, excluding items that couldnot be updated top link mappings. I had to create a new adapter and it worked.
Concerning
-
How to configure Hostname of the node with the REST API?
I tried the value of hostname of the virtual machine when I deploy an application, but were unsuccessful. The application consists of all the operating system - there is no installed service but an example here that I used when I deployed the application. It is based on the release of the REST API "node info": for the particular deployment profile.
{
'node': [{}
"name': 'VM1."
"properties": [{}
"hostname": "joe".
}],
["nodeComponent":]
}]
}
But when you use this application I get the error message: "the node 'VM1' does not exist in the current 'deployment profile'. ' even if 'VM1' is the only node in the deployment profile. I tried other variations and still get the same error message.
Does anyone have suggestions for how I can configure the hostname of the node when you deploy the application? Thank you.
Apparently, the REST API for planning a deployment is designed after characteristic GUI Application Director "rapid deployment". Rapid deployment does not allow the substitution of properties of node as hostname. Idea being the deployment profile once defined and prepared, each individual call of it must change some subset of the properties of the component. We can always create several profiles of deployment to account for changes in node.
Nevertheless, it seems that property of node specifications would help your situation... so that your comments reached the product team.
Thank you rags
This posting is provided as is and confers no rights.
-
iTunes is updating the iPhone - with the exception of apps
Running iOS 9.3.1 and 12.3.3.17 iTunes and a wired synchronization seems (on the surface) work very well. I noticed recently that even if my phone syncs with iTunes without error, the apps on the iPhone to date never actually.
- iPhone says that I need 22 app updates updates. In addition, I cannot sync wireless so I need to do a wired update anyway.
- Start iTunes - I can download all latest updates in iTunes
- Sync iPhone - all measures seem to be working correctly and synchronize changes to music without any problem.
- Look at iPhone - App Store icon always displays a red number 22 applications that need to update.
At this point, the only way I can update the apps on the iPhone is via clicking on the App Store app and 'update all '. Successfully it is updating applications cell / Wireless without any problem. I don't know why the iPhone updates not when physically (not wireless) plugged in iTunes. He used to work - a few months ago, that it seemed to work very well. Just noticed this. The good news is that I can get the end apps iPhone update - I just can't understand why something that work isn't is no longer. Any suggestions?
When connected to iTunes look in the applications tab of the device. It is sync selected apps?
TT2
-
I had to change my Apple ID due to fraudulent charges but my iPhone 6s 9.2 still has the old Apple ID and will not accept old or new passwords. How can I update the iPhone 6s 9.2 with the new Apple ID and password? I tried to perform a complete reset, but which requires the Apple ID and password that doesn't work not... pretty frustrated here.
YYou have unlink the old iphone you as find my iphone the reset all devices on this subject from your account then plug it to your iTunes then restore a new one after that reset password that under the new phone then connect
-
Context: Target cannot find the node with id 33
Hello
In my qml file, I used the spreadsheet component. When you click the button, I tried to call the RPC function that calls the web service and according to the response from the service web I have to redirect to special qml. But while qml opening of the CPP, I get the following errors.
libpng warning: iCCP: known incorrect sRGB profile Context: Failed to find target node with id 33
For a moment, I am able to redirect to special qml but control returned to previous qml.
I am not able to understand why this error came? When I run my application a day before it was working fine. When I reset the device and upgrade the operating system 10.2 I get this error.
Here is my code in the PRC:
QmlDocument *qml = QmlDocument::create("asset:///backgroundProcessImageFile.qml"); qml->setContextProperty("RoamAssist", this); AbstractPane *root = qml->createRootObject
(); globalApp->setScene(root); Hey... my problem is solved...
Insted to create the user interface using the sheet I just create new page and open it using NavigationPane.
I still don't know if this issue is due to the component of the roadmap or due to the os version upgradation.
-
How to update the table with the number management
Hello
I need as there is a loc_tab of the created table as below,
CREATE TABLE loc_tab
(
Country_ID NUMBER,
country_code VARCHAR2 (3),
country_name VARCHAR2 (50).
State_ID NUMBER,
state_code VARCHAR2 (3),
state_name VARCHAR2 (50).
city_id NUMBER,
city_code VARCHAR2 (3),
city_name VARCHAR2 (50)
);
I inserted records like below,
Now, I wanted to update the table such that all ID columns are updated with running number.COUNTRY_ID COUNTRY_CODE COUNTRY_NAME STATE_ID STATE_CODE STATE_NAME CITY_ID CITY_CODE CITY_NAME IND INDIA TN TAMIL NADU CHN CHENNAI IND INDIA TN TAMIL NADU TRI TRICHY IND INDIA TN TAMIL NADU CMT COIMBATORE IND INDIA TN TAMIL NADU MDU MADURAI IND INDIA AP ANDHRA PRADESH HYD HYDERABAD IND INDIA AP ANDHRA PRADESH SEC SECUNDRABAD AUS AUSTRALIA QLD QUEENSLAND BRI BRISBANE AUS AUSTRALIA TAS TASMANIA HB HOBART AUS AUSTRALIA TAS TASMANIA CCE CITY OF CLEARANCE AUS AUSTRALIA TAS TASMANIA BUR BURNIE
Each ID columns should get incremented so that, for Country_ID column corresponding to "India" If country_id is 1, that there must be one for all the lines with the name as "India". Likewise for "Australia".
In the case of State, she also has the same logic with numbers repeated until the very name of the State comes.
For the city, it of course will hold separate ID only because the name of the city will not get duplicated.
This update must be done in the normal way using simple SQL such as no PLSQL don't like looping, etc... is involved.
Here are the contents of the table, and that's how the table should be updated,
Thank you and best regards,COUNTRY_ID COUNTRY_CODE COUNTRY_NAME STATE_ID STATE_CODE STATE_NAME CITY_ID CITY_CODE CITY_NAME 1 IND INDIA 1 TN TAMIL NADU 1 CHN CHENNAI 1 IND INDIA 1 TN TAMIL NADU 2 TRI TRICHY 1 IND INDIA 1 TN TAMIL NADU 3 CMT COIMBATORE 1 IND INDIA 1 TN TAMIL NADU 4 MDU MADURAI 1 IND INDIA 2 AP ANDHRA PRADESH 1 HYD HYDERABAD 1 IND INDIA 2 AP ANDHRA PRADESH 2 SEC SECUNDRABAD 2 AUS AUSTRALIA 1 QLD QUEENSLAND 1 BRI BRISBANE 2 AUS AUSTRALIA 2 TAS TASMANIA 1 HB HOBART 2 AUS AUSTRALIA 2 TAS TASMANIA 2 CCE CITY OF CLEARANCE 2 AUS AUSTRALIA 2 TAS TASMANIA 3 BUR BURNIE
Shiva
-
x 61 was updated the BIOS with 7nuj21us.exe Failed BIOS update utility
Only, I have restored my x 61 to the original settings due to a problem with the blue screens and decided to update the BIOS right afterwards. I followed the directions precisely and installed all 21 of each component for this model.
I then turn off the computer and turned it back this morning to continue to load the software. The system started with the fan running at high speed and stopped at the ThinkPad screen. However, nothing happened after pressing the ThinkVantage button and F1 or another touches besides. I left for a few hours, but finally determined that I could not turn off or do anything with the machine. He just hung there. I did finally remove the battery and replace it and now there is not able to record when the machine is connected and it does not start.
Is there something I can do to recover the system? I suspect that the answer is a replacement of the Commission. The update of the BIOS was not at the same time with something on my computer. I have just 2 years in the warranty period at the United States, so if I need to replace the card, what are the best options?
Thanks for your help and comments... it is a very frustrating twist, because this is my work machine.
Dmtrich,
Certainly, we can download and system flash here, just to be safe.
I'm sorry that you have had this problem, I sent you a PM and email and we can follow up there to work through your specific. Please let us know your concerns!
Best regards
Mark
Maybe you are looking for
-
Podcast stopped to update on iTunes
I have six different podcasts on iTunes. They are all created using the Wordpress plugin seriously Simple Podcasting (https://www.seriouslysimplepodcasting.com/). It allows me to create separate podcasts as much as I want with different signals. This
-
Re: Satellite U500 - can I install Windows XP?
Have recently bought a Toshiba Satellite U500 laptop. It came with Windows 7. It is very unstable. Programs that don't crash XP, crash regularly in Windows 7. Including Windows Internet Explorer and Windows Explorer (especially painful if you have ru
-
Does anyone know, if Windows 2000 is put on the laptop next would create a problem with device drivers - specifically for the serial port (RS232, communications). I wonder, as I work with old technology and require a TRUE - no USB converters series s
-
While on mobile sites and can not zoom the text is blurry
on sites that recognize me as a mobile site, or use mobile sites, when I can't zoom in I have no problem with the beta 1 freeze or force close. But the text is vague and will not erase upward. While using the usual browser can't display anything it w
-
Pavilion a6430F desktop: cannot display this page
Read a recent post on "Apps does not connect to internet" and felt that I had a similar problem. I am running Win7, SP1, 64-bit, on a desktop Pavilion a6430F with 6 GB of RAM on an AMD Phenom triple core processor. I frequently get "cannot display t