动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
电脑书籍下载:程序设计书籍 | 数据库教程书籍 | 平面与多媒体书籍 | 网络通讯书籍 | 系统管理书籍 | 网络安全书籍 | 认证考试书籍
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > Oracle教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ Oracle教程 ]的信息



本月文章推荐
.Oracle数据库中LONG类型字段的存.
.安装Ora9i_9204要用到的补丁,刚.
.How to Install Orabm.
.怎样使两台服务器的oracle9i的数.
.基于主键和唯一约束的显示索引控.
.如何使用oracle的decode函数进行.
.sp_addlinkersrvlogin从oracle查.
.Oracle10g废弃log_archive_start.
.Re: 请问youngcow的FTP上DB2_win.
.Oracle 10g中利用哈希函数提高查.
.用sqlplus只输出数据到文本文件的.
.Oracle8i和MS SQL Ser.
.没有备份只有归档日志如何恢复数.
.Oracle9i新特性:iSQLPLUS.
.Oracle数据库密码破解易如反掌?.
.Oracle学习手册:Oracle游标使用.
.双机容错方案.
.oracle数据库如何增加表空间大小.
.Oracle的實体化視圖管理.
.基于 Linux 和 MiniGUI 的嵌入式.

在Oracle ERP中导数据(BOM清单)

发表日期:2008-2-9 |



  方法:把数据导入BOM清单的方法是,把数据导入接口表中,让其自动运行既可。上传文件的时候,要注重使 用ASCII字符模式。
  
  1、自己建立一中转表
  
  drop table cux_bill_temp;
  
  create table cux_bill_temp(
  
  bill_sequence_id number,
  
  assembly_item_id number,
  
  organization_id number,
  
  assembly_item varchar2(50), --BOM
  
  component_sequence_id number,
  
  component_quantity number, --组件数量
  
  item_num number, --项目序列
  
  operation_seq_num number, --工序序列
  
  component_item_id number,
  
  component_item varchar2(50), --组件
  
  PLANNING_FACTOR number, --计划%d100
  
  component_yield_factor number, --产出率d1
  
  wip_supply_type number, --供给类型
  
  supply_type varchar2(50),
  
  supply_subinventory varchar2(50), --供给子库存
  
  OPTIONAL number, --可选的
  
  OPTIONAL_disp varchar2(10), --可选的
  
  MUTUALLY_EXCLUSIVE_OPTIONS number, --互不相容
  
  MUTUALLY_EXCLUSIVE_O_disp varchar2(10), --互不相容
  
  attribute1 varchar2(50), --排序号
  
  row_num number)
  
  ;
  
  2、删除中转表中的数据
  
  delete cux_bill_temp;
  
  3、把要导入的数据放在扩展名为*.csv的文件中,且要相对应于中转表的字段,本例中的文件名为bill.csv。
  
  另外的脚本文件为bill.ctl,其内容如下:
  
  options (skip=1) //跳过第一行,一般第一行为其字段说明
  
  LOAD DATA
  
  INFILE bill.csv //bill.csv为数据文件
  
  APPEND
  
  INTO TABLE cux_bill_temp
  
  FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
  
  (与中转表相对应的字段列表)
  
  登录进入Oracle数据库服务器,利用命令:(sqlload 用户名/密码@数据库名)载入文件bill.csv的数据入中转表。
  
  4、查看中转表中的记录数(以备导入数据后进行对比)
  
  select count(*) from cux_bill_temp;
  
  5、去除导入时在表bill.csv中的要害字段的空格字符,以免影响导入。
  
  update cux_bill_temp
  
  set ASSEMBLY_ITEM=replace(ASSEMBLY_ITEM,' ',''),
  
  COMPONENT_ITEM=replace(COMPONENT_ITEM,' ','');
  
  6、查看是否有重复的选项(既是否重复了Item)
  
  select assembly_item,component_item,min(row_num),count(*)
  
  from cux_bill_temp
  
  group by assembly_item,component_item
  
  having count(*)>1;
  
  假如有重复的Item,则要删除(或是重新合并)
  
  delete cux_bill_temp
  
  where row_num in (select min(row_num) from cux_bill_temp
  
  group by assembly_item,component_item
  
  having count(*)>1);
  
  以下步骤为选做(如有重复才做,没有重复不做7-10)
  
  7、再重新建立一个临时表(对于有重复数据,则只取一条数据,现取row_num最小的一条)
  
  drop table cux_bill_a;
  
  create table cux_bill_a
  
  as
  
  select assembly_item,
  
  component_item,
  
  component_quantity,
  
  PLANNING_FACTOR,
  
  component_yield_factor,
  
  supply_type,
  
  supply_subinventory,
  
  OPTIONAL_disp,
  
  MUTUALLY_EXCLUSIVE_O_disp,
  
  attribute1,
  
  min(row_num) row_num
  
  from cux_bill_temp
  
  group by assembly_item,
  
  component_item,
  
  component_quantity,
  
  PLANNING_FACTOR,
  
  component_yield_factor,
  
  supply_type,
  
  supply_subinventory,
  
  OPTIONAL_disp,
  
  MUTUALLY_EXCLUSIVE_O_disp,
  
  attribute1;

  
  8、删除cux_bill_temp表
  
  delete cux_bill_temp;
  
  9、再重cux_bill_a表中把数据导入给cux_bill_temp表,完成把重复数据剔除的功能
  
  insert into cux_bill_temp(
  
  assembly_item,
  
  component_item,
  
  component_quantity,
  
  PLANNING_FACTOR,
  
  component_yield_factor,
  
  supply_type,
  
  supply_subinventory,
  
  OPTIONAL_disp,
  
  MUTUALLY_EXCLUSIVE_O_disp,
  
  attribute1,
  
  row_num)
  
  select assembly_item,
  
  component_item,
  
  component_quantity,
  
  PLANNING_FACTOR,
  
  component_yield_factor,
  
  supply_type,
  
  supply_subinventory,
  
  OPTIONAL_disp,
  
  MUTUALLY_EXCLUSIVE_O_disp,
  
  attribute1,
  
  row_num
  
  from cux_bill_a;
  
  10、删除表cux_bill_a
  
  drop table cux_bill_a;
  
  11、再检查一次表,是否有重复的数据
  
  select assembly_item,component_item,min(row_num),count(*)
  
  from cux_bill_temp
  
  group by assembly_item,component_item
  
  having count(*)>1;
  
  12、查看在mtl_system_items表中,既是在库存表中,有没有不存在的Item.
  
  select distinct item
  
  from (
  
  select distinct assembly_item item
  
  from cux_bill_temp b
  
  where not exists (select null from mtl_system_items where segment1=b.assembly_item and organization_id=2)
  
  union
  
  select distinct component_item item
  
  from cux_bill_temp b
  
  where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2)
  
  )
  
  order by item;
  
  13、假如在mtl_system_items中,有不存在的物品ITEM时,要把其删除(或是把这些物品Item导入到系统中)
  
  删除:delete cux_bill_temp b
  
  where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2);
  
  delete cux_bill_temp a
  
  where not exists (select null from mtl_system_items where segment1=a.assembly_item and organization_id=2);
  
  14、对没有物品Item的进行处理,把其放入另一临时表cux_item_temp中(以备查询及导入mtl_system_items表中)
  
  delete cux_item_temp;
  
  insert into cux_item_temp(
  
  segment1,description)
  
  select distinct item,item
  
  from (
  
  select distinct assembly_item item
  
  from cux_bill_temp b
  
  where not exists (select null from mtl_system_items where segment1=b.assembly_item and organization_id=2)
  
  union
  
  select distinct component_item item
  
  from cux_bill_temp b
  
  where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2)
  
  )
  
  ;

  
  将找到没有ITEM的BOM数据放到另一个表中,以备下次ITEM导入后在导BOM
  
  create table cux_bom_temp1
  
  select distinct item
  
  from (
  
  select distinct assembly_item item
  
  from cux_bill_temp b
  
  where not exists (select null from mtl_system_items where segment1=b.assembly_item and organization_id=2)
  
  union
  
  select distinct component_item item
  
  from cux_bill_temp b
  
  where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2)
  
  )
  
  -----------------------------------------------------------------------------------------------------------
  
  15、从表mtl_system_items中把物品的编码ID加入中转表cux_bill_temp表(从项目主组织)中
  
  update cux_bill_temp b
  
  set assembly_item_id=(select inventory_item_id from mtl_system_items
  
  where segmen
上一篇:Oracle 10g学习手册2:安装与构建一(图) 人气:696
下一篇:入门答疑:怎样从DOS系统引导Linux系统 人气:361
浏览全部Oracle教程的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-7-24 Sablog-X v2.0 预览版
2008-7-24 帝国备份王EmpireBak 2008 正式版
2008-7-24 网趣网上购物系统时尚版 v8.2
2008-7-24 纵横B2B电子商务系统XYECS!B2B v
2008-7-24 e路小说小偷 v1.2.0723
2008-7-24 凌风美女图片站程序 v2.2
2008-7-24 TOM15电影收索程序
2008-7-24 清风信息自动采集生成系统 v1.0
2008-7-24 QQ邮箱编辑器 v1.0 (小小菜刀ASP
2008-7-19 UltraEdit 简体中文增强版 14.10
2008-7-19 CentOS 5.2 i386 LiveCD
2008-7-19 Snapture多功能相机 v1.4
2008-7-19 iAcces中文输入法 v1.0Build016
2008-7-19 Cookbook烹饪秘籍 v2.5
2008-7-19 苹果专用DVD转换工具 v1.1.59汉化
2008-7-19 Modem修复软件ZiPhone修改版04.0
2008-7-19 AgileMessenger即时通讯工具美化
2008-7-19 Sketches画图软件 v0.7b6破解版


  发表评论
姓 名: 验证码:
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵