【发布时间】:2016-03-22 09:24:15
【问题描述】:
我有一个非常奇怪的 xquery 问题。我遍历一个包含大约 80000 个节点值的大 xml:
insert
into xxif_vendor_onhand_interface (
vendor_onhand_interface_id
,created_by
,creation_date
,last_updated_by
,last_update_date
,status_code
,vendor_site_id
,org_id
,inventory_item_id
,vendor_item_number
,vendor_onhand_quantity)
select xxif_vendor_onhand_interface_s.nextval
,fnd_global.user_id
,sysdate
,fnd_global.user_id
,sysdate
,'NEW'
,vs.vendor_site_id
,vs.org_id
,asl.item_id
,asl.primary_vendor_item
,x.oh_qty
from xxpo_vendor_site_attributes vsa
,po_vendor_sites_all vs
,xmltable(
'for $i in /TBSTOCK/ARTICLE return $i'
passing l_xml
columns "TB_SKU" varchar2(50) path '/ARTICLE/A_NR'
,"OH_QTY" number path '/ARTICLE/A_STOCK'
) x
,po_approved_supplier_list asl
where vsa.attribute_name = '???'
and vsa.attribute_value = 'Y'
and vs.vendor_site_id = vsa.vendor_site_id;
我希望结果中的数量相同,但结果中只有最后 10.000 个值。
我已确保使用此代码:
--onhand logging
BEGIN
v_history_s := xxif_tb_onhand_history_s.NEXTVAL;
INSERT INTO xxif_tb_oh_history_headers (xxif_tb_onhand_history_id,
onhand_xml,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login)
VALUES (v_history_s,
l_xml,
NVL (fnd_global.user_id, -1),
SYSDATE,
NVL (fnd_global.user_id, -1),
SYSDATE,
NVL (fnd_global.login_id, -1));
FOR r
IN (SELECT EXTRACTVALUE (VALUE (p), '/ARTICLE/A_NR') AS a_nr,
EXTRACTVALUE (VALUE (p), '/ARTICLE/A_STOCK') AS a_stock
FROM TABLE (XMLSEQUENCE (EXTRACT (l_xml, '/TBSTOCK/ARTICLE'))) p)
LOOP
INSERT INTO xxif_tb_oh_history_lines (xxif_tb_onhand_history_id,
a_nr,
a_stock,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login)
VALUES (v_history_s,
r.a_nr,
r.a_stock,
NVL (fnd_global.user_id, -1),
SYSDATE,
NVL (fnd_global.user_id, -1),
SYSDATE,
NVL (fnd_global.login_id, -1));
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
似乎数据将在 10.000 条记录后被覆盖。我不知道问题出在哪里。表格中只有 xml 中的最后 9.000 个值。
有什么想法吗?
提前致谢 蒂姆
【问题讨论】:
-
将您的解决方案添加为答案并将其标记为已接受
标签: xml oracle oracle11g xquery