繁体   English   中英

Oracle(11g)奇怪的XQuery行为

[英]Oracle(11g) strange xquery behaviour

我有一个非常奇怪的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个值。

有任何想法吗?

提前谢谢蒂姆

大家好,我自己解决了。

  1. 我已经在Clob中获取xmltype变量

l_oh_clob:= l_xml.getClobVal();

  1. 将Clob转换为xmltype

xmltable('for $ i in / TBSTOCK / ARTICLE return $ i'传递xmltype(l_oh_clob)列“ TB_SKU” varchar2(50)路径'/ ARTICLE / A_NR',“ OH_QTY”数字路径'/ ARTICLE / A_STOCK')x, po_approved_supplier_list asl;

不漂亮,但可以!

提姆

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM