【发布时间】:2017-11-17 21:22:27
【问题描述】:
我正在尝试测试一个以 xml CLOB 作为参数的 PL/SQL 过程
PROCEDURE example_proc(ex_xml CLOB) IS
BEGIN
/* Find the second < (skip over declaration) */
ln_position := instr(pc_shipment_xml, '<', 1, 2);
/* Find the space after the first tag */
ln_position := instr(pc_shipment_xml, ' ', ln_position, 1);
/* Set the first part of the XML clob */
lc_shipment_xml := substr(pc_shipment_xml, 1, ln_position - 1);
/* Skip the namespace */
ln_position := instr(pc_shipment_xml, '>', ln_position, 1);
lc_shipment_xml := lc_shipment_xml || substr(pc_shipment_xml, ln_position);
/* Set the XML type */
lx_shipment_xml := xmltype(lc_shipment_xml); --RIGHT HERE IS WHERE IT ERRORS OUT
这是我传入的 xml(作为 ex_xml clob 参数):
xml :=
'<Shipment>
<OrderNumber>00000</OrderNumber>
<ShipmentLines>
<ShipmentLine>
<OrderDetailId>000000</OrderDetailId>
<LineNumber>0</LineNumber>
<ItemId>00000</ItemId>
<UnitId>0000000</UnitId>
<BaseUom>X</BaseUom>
<Quantity1>000</Quantity1>
</ShipmentLine>
</ShipmentLines>
</Shipment>';
它在最后一行出错:
ORA-19202: Error occurred in XML processing
LPX-002255: end-element tag "ShipmentLines" does not match start-element tag "Shipment"
请原谅我的无知,但这是我第一次在 PL/SQ 中使用 XML,我是否遗漏了格式?据我所见,我正在正确打开和关闭我的标签。任何意见都表示赞赏。
【问题讨论】:
-
您真的尝试使用
instr、substr等修改XML 文档吗?看看XML Functions
标签: xml oracle plsql clob xmltype