码迷,mamicode.com
首页 > 其他好文 > 详细

更改最小包装量脚本

时间:2018-03-01 21:51:42      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:declare   output   value   更改   nbsp   date   res   number   use   

declare
  ln_plantid     number;
  ln_itemid      number;
  ln_checkResult number;
  lv_uom         varchar(50);
  ln_isExist     number;

begin
  for cur in (select * from xxx x) loop
  
    begin
      select p.plant_id
        into ln_plantid
        from hcm_plant p
       where p.plant_code = cur.attr1;
    exception
      when others then
        continue;
        dbms_output.put_line(取工厂ID出错!);
    end;
  
    begin
      select i.item_id, i.primary_uom
        into ln_itemid, lv_uom
        from hcm_item i
       where i.item_code = cur.attr2
         and i.plant_id = ln_plantid;
    exception
      when others then
        continue;
        dbms_output.put_line(取物料ID出错! || cur.attr2);
    end;
  
    select count(1)
      into ln_isExist
      from hcm_item_control T
     WHERE T.PLANT_ID = ln_plantid
       and t.item_id = ln_itemid;
  
    if ln_isExist > 0 then
      update hcm_item_control t
         set t.cid            = hcm_item_control_cid_s.nextval,
             t.min_supply_qty = to_number(cur.attr3)
       where t.item_id = ln_itemid
         and t.plant_id = ln_plantid;
      dbms_output.put_line(--------------------物料在库存表里面已经存在!);
    else
    
      /*insert into HME_ITEM_ONHAND_QUANTITIES
      (plant_id,
       Item_Id,
       Warehouse_Code,
       Locator_Code,
       Loct_Onhand,
       Lot_Number,
         Uom_Code,
         Server_Id)
      values
        (ln_plantid,
         ln_itemid,
         cur.warehouse,
         cur.locator,
         cur.qty,
         cur.lotnumber,
         lv_uom,
         2);*/
    
      dbms_output.put_line(---------------------------------不存在);
    
    end if;
  end loop;
end;

 

更改最小包装量脚本

标签:declare   output   value   更改   nbsp   date   res   number   use   

原文地址:https://www.cnblogs.com/xyzabc0004/p/8490075.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!