xml - Incorrect XPath in extractValue method of PLSQL -


Does anyone help me in fixing the XPath statement that goes into the statement of SQL (Oracle) To remove the price of & lt; BrandName & gt; is "Bravo" and whose model name is "XYZ789":

  & lt; CarDetails & gt; & Lt; Wheels & gt; & Lt; Rim & gt; & Lt; BrandName & gt; Acme & lt; / BrandName & gt; & Lt; Model & gt; & Lt; Name & gt; ABC123 & lt; / Name & gt; & Lt; Price & gt; $ 350.00 & lt; / Pricing & gt; & Lt; / Model & gt; & Lt; / Rim> & Lt; Rim & gt; & Lt; BrandName & gt; Bravo & lt; / BrandName & gt; & Lt; Model & gt; & Lt; Name & gt; XYZ789 & lt; / Name & gt; & Lt; Price & gt; $ 250.00 & lt; / Pricing & gt; & Lt; / Model & gt; & Lt; Model & gt; & Lt; Name & gt; GHI456 & lt; / Name & gt; & Lt; Price & gt; $ 300.00 & lt; / Pricing & gt; & Lt; / Model & gt; & Lt; / Rim> & Lt; / Wheels & gt; & Lt; / CarDetails & gt; The above XML Club has been stored in an oracle table called  car , which has columns called 'id', 'version' and 'XML document'. X where extract value (x.xml_document, cars: example: 3_1 "xmlns: b =" x "):    SELECT * FROM (Select x.xml_document.GetClobVal) "Cars: Cars / B: Wheels / B: Rim [B: Brand Name =" Bravo "] / B: Model / B: Name ',' xmlns: a =: Perceptual Model: 3_1 '') ('XYZ789') Order X.id, by x.version) where ROWNUM   

... but it does not pull out any information at all should remove a record of it. That data exists in XML, and this That statement works, when I change the xath inside the extractValue call to get another value, so obviously XPath is incorrect in my SQL. < / Pre>

Anyone can: offer any suggestion as should look like my SQL code = Extract value ?

Thank you in advance.

If you want a car's price The brand name "Bravo" and its model name is "XYZ789", then the following XPath should receive: / a: car details / b: wheels / b: B: value

In fact, it is in verb:

  sql> SET serverTout on SQL and GTT; DECLARE 2 v_xml_string VARCHAR2 (4000): = '& lt; A: cardiems xmlns: a = "car: example: 3_1" & gt; 3 more lieutenant; B: Wheels xmlns: B = "Cars: Conceptual Components: 3_1" & gt; 4 & lt; B: Rim> 5 & ​​lt; B: Brand name & gt; Acme & lt; / B: Brand name & gt; 6 & lt; B: model & gt; 7 & lt; B: Name & gt; ABC 123 & lt; / B: name & gt; 8 & lt; B: Pricing & gt; $ 350.00 & lt; / B: Pricing & gt; 9 & lt; / B: model & gt; 10 11 & lt; / B: rim> 12 & lt; B: Rim> 13 & lt; B: Brandonam & gt; Bravo & lt; / B: Brandonam & gt; 14 & lt; B: model & gt; 15 & lt; B: Name & gt; XYZ78 9 & lt; / B: name & gt; 16 & lt; B: Pricing & gt; $ 250.00 & lt; / B: Pricing & gt; 17 & lt; / B: model & gt; 18 & lt; B: model & gt; 19 & lt; B: Name & gt; GHI456 & lt; / B: name & gt; 20 & lt; B: Pricing & gt; $ 300.00 & lt; / B: Pricing & gt; 21 & lt; / B: model & gt; 22 & lt; / B: rim> 23 & lt; / B: wheels & gt; 24 & lt; / A: Car details & gt; '; 25 v_result VARCHAR2 (4000); Model [B: name = "XYZ789"] / B: 26 [B] 27 exchange value (x_xml_string), 28 '/ A: car details / B: wheels / b: rim [B: brand name = "Bravo"] / B: value ', 29' xmlns: a = "car: example: 3_1" xmlns: b = "car: conceptual object: 3_1" '30) from secondary to v_result; 31 32 dbms_output.put_line (v_result); 33nd; 34 / $ 250.00 PL / SQL Process successfully completed SQL & gt;   

When I tried to run my XPath on my XML (after adding it to a and b namespace), then I got an error "ORA-192525: ExtrasView gives value only one node". This is because only one result can handle XPath to return the node in your XML, there are two nodes that match your XPath: two elements with content XYZ789 and GHI456 .

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -