1.建临时表:(字段对应excel表头)
create table temp_GYS_table(
code varchar2(32), --代码
name varchar2(100), --供应商名称
shuihao varchar(100),--税号
dizhi varchar(255), --地址电话
yhzh varchar(255), --银行账号
sjr varchar(100), --收件人
sjrdh varchar(100), --收件人电话
sjrdz varchar(255) --收件人地址
);
2.Plsql-->工具(tool)-->ODBC导入器(ODBC Importer)
用户/系统 DSN选择第二项Excel Files
3.选择连接(Connect)在弹出框里选择你要导入的Excel文件
4.预览你的数据,之后单击 到ORACLE的数据(Data to Oracle)
5.操作步骤
5.1选择表名和数据库登录名
5.2选择excel表头对应的临时表字段
5.3点击导入按钮
6.导入成功,查看导入的数据:
select * from temp_GYS_table ;
将临时表的数据更新到供应商(wms_Organization)表中:
字段一一对应更新
--供应商名称
update wms_organization o set o.name=(select temp.name from temp_GYS_table temp where o.code=temp.code)
where exists
(select 1 from temp_GYS_tbale t where o.code=t.code)
and o.is_supplier='Y'
--税号
update wms_organization o set o.c_tax_Code=(select temp.shuihao from temp_GYS_table temp where o.code=temp.code)
where exists
(select 1 from temp_GYS_tbale t where o.code=t.code)
and o.is_supplier='Y'
--开户行及账号
update wms_organization o set o.c_bank_Account_Num=(select temp.yhzh from temp_GYS_table temp where o.code=temp.code)
where exists
(select 1 from temp_GYS_tbale t where o.code=t.code)
and o.is_supplier='Y'
7.更新完成后删除临时表:
Drop table temp_GYS_table;