【发布时间】:2020-10-01 17:30:32
【问题描述】:
我想通过我的函数 my_calculator 更改 oracle xmltype 节点值,但我不能。 见那里:
set serveroutput on
declare
w_xml xmltype;
begin
SELECT
XMLQUERY('copy $tmp := .
modify
(for $l3 in $tmp//Line3
return replace value of node $l3 with my_calculator($l3)
)
return $tmp'
PASSING xmltype('<Response><Card>
<Address attr_cust="0">
<Line2>def</Line2>
<Line3>10</Line3>
<Line4>jkl</Line4>
<Line5>mno</Line5>
<Country/>
</Address>
</Card>
<Card>
<Address attr_cust="0">
<Line2>def</Line2>
<Line3>12</Line3>
<Line4>jkl</Line4>
<Line5>mno</Line5>
<Country/>
</Address>
</Card>
</Response>') RETURNING CONTENT)
into w_xml
FROM dual;
dbms_output.put_line( w_xml.extract('/*').getClobVal() );
end;
返回:
Error report -
ORA-19237: XPST0017 - unable to resolve call to function - fn:my_calculator
ORA-06512: at line 5
19237. 00000 - "XPST0017 - unable to resolve call to function - %s:%s"
*Cause: The name and arity of the function call given could not be matched with any in-scope function in the static context.
*Action: Fix the name of the function or the number of parameters to match the list of in-scope functions.
我可以在 "return replace value of node $l3 with my_calculator($l3)" 中使用用户函数吗? 非常感谢。
【问题讨论】:
-
向我们展示您的函数代码文本
-
这是一个简单的函数:创建或替换 FUNCTION my_calculator( orig_value INT) RETURN INT IS BEGIN RETURN orig_value + 100;结束;
标签: oracle plsql xmltype qxmlquery