Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Passing path in XMLQUERY

3891771Feb 18 2019 — edited Mar 4 2019

I need some help to pass the path dynamicaly using xmlquery as example below.

At line 10 I want something like : $input_path (input_path := "Test1\Test2")

The input_value is Test3

I tried but I get the error "ORA-19224: XPTY0004 - não correspondência de tipos estáticos XQuery: era esperado - node()* foi obtido - xs:string". 

  1. create table xqupdate as  
  2.     select 1 as ind,to_clob('<ns:Test1 xmlns:ns="abc"><Test2><ns:Test3>adfkgjdfgkljhhgkjdfhgldkfjgh</ns:Test3></Test2></ns:Test1>') clobdata 
  3.     from dual; 
  4.      
  5. create or replace procedure test_Clob(p_input_tag_name varchar2, p_tag_update_Value varchar2) as 
  6. begin 
  7.     update xqupdate set clobdata = 
  8.     xmlquery( 
  9.         'copy $tmp := . 
  10.         modify (for $i in $tmp//*[local-name()=$input_tag] return replace value of node $i with $input_value) 
  11.         return $tmp' 
  12.         passing xmltype(clobdata), p_input_tag_name as "input_tag", p_tag_update_value as "input_value" 
  13.         returning content 
  14.     ).GetClobVal() 
  15.     where ind = 1; 
  16. end test_Clob; 
Comments
Post Details
Added on Feb 18 2019
1 comment
1,327 views