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".
- create table xqupdate as
- select 1 as ind,to_clob('<ns:Test1 xmlns:ns="abc"><Test2><ns:Test3>adfkgjdfgkljhhgkjdfhgldkfjgh</ns:Test3></Test2></ns:Test1>') clobdata
- from dual;
-
- create or replace procedure test_Clob(p_input_tag_name varchar2, p_tag_update_Value varchar2) as
- begin
- update xqupdate set clobdata =
- xmlquery(
- 'copy $tmp := .
- modify (for $i in $tmp//*[local-name()=$input_tag] return replace value of node $i with $input_value)
- return $tmp'
- passing xmltype(clobdata), p_input_tag_name as "input_tag", p_tag_update_value as "input_value"
- returning content
- ).GetClobVal()
- where ind = 1;
- end test_Clob;