资深而专注的郑州网络公司                                   郑州网站建设 | 网站优化 | 洛阳网络公司 | 洛阳网站建设 | 网络公司   
郑州网络公司 咨询热线:0371-63653120 63658758  客服QQ 757700863 335050586
      网站优化推广案例中心客服中心加盟合作联系我们付款方式
首 页 域名注册 虚拟主机 数据库空间 Jsp 空间 主机托管 VPS 主机 主机租用 企业邮局 网站建设
会员登陆
用户名:
密 码:
客服中心
sqlldr加载数据到不同表的问题
作者:无   加入时间:2008-6-19 14:39:26   点击次数:80
◆首先我们来创建测试表:

D:\Orion>sqlplus eygle/eygle

SQL*Plus: Release 9.2.0.6.0 - Production on 星期一 11月 11 12::20 2007

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

连接到:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production

19:53:59 SQL> create table test1 (
19:54:14   2  a1 varchar2(10),
19:54:21   3  a2 varchar2(10),
19:54:26   4  a3 varchar2(10));

表已创建。

已用时间:  00: 00: 00.03
19:54:32 SQL> create table test2 (
19:54:35   2  a1 varchar2(10),
19:54:39   3  a2 varchar2(10),
19:54:40   4  a3 varchar2(10));

表已创建。

已用时间:  00: 00: 00.04
23:21:42 SQL> exit
从Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production中断开

  ◆然后我们来测试数据:

D:\Orion>cat data.txt
01,KunMing,YunNan
02,BeiJing,BeiJing
02,ShenZhe,ShenZhe
02,TianJin,TianJin
D:\Orion>

  ◆控制文件

D:\Orion>cat data.ctl
LOAD DATA
INFILE 'data.txt'
APPEND INTO TABLE test1
WHEN (2) = '1'
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY " " TRAILING NULLCOLS
( a1 POSITION(01:02), a2 POSITION(04:10), a3 POSITION(12:19) )
INTO TABLE test2
WHEN (2) = '2'
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY " " TRAILING NULLCOLS
( a1 POSITION(01:02), a2 POSITION(04:10), a3 POSITION(12:19) )

  ◆加载数据

D:\Orion>sqlldr eygle/eygle errors=20000 log=data.log control=data.ctl

SQL*Loader: Release 9.2.0.6.0 - Production on 星期一 11月 11 12:23:21 2007

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

达到提交点,逻辑记录计数3
达到提交点,逻辑记录计数4

  ◆检查结果

D:\Orion>sqlplus eygle/eygle

SQL*Plus: Release 9.2.0.6.0 - Production on 星期一 11月11  12:31:29 2007

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

连接到:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production

19:57:38 SQL> select * from test1;

A1         A2         A3
---------- ---------- ----------
01         KunMing    YunNan

已用时间:  00: 00: 00.00
19:57:42 SQL> select * from test2;

A1         A2         A3
---------- ---------- ----------
02         BeiJing    BeiJing
02         ShenZhe    ShenZhe
02         TianJin    TianJin

已用时间:  00: 00: 00.00
19:57:45 SQL> exit
从Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production中断开

  注释:假如你不选择分区表,就可以用这个方式来直接加载数据到不同的数据表中。

上一篇: 没有了
下一篇: 企业必“邮”成为企业成功之路
客服中心
域名注册帮助 虚拟主机帮助
数据库空间 JSP 空间帮助
主机托管帮助 主机租用帮助
企业邮局帮助 网站建设帮肋
协议文件下载 代理客户帮助
新闻中心
公司动态
网站公告
业界新闻
新站发布
最新客户
洛嘉海兰德车业有限公司
郑州芘芘秀婴儿拍摄专家
上海三宜办公家具有限公司
洛阳宇通汽车有限公司
洛阳花都金柜集团有限公司
中国机动车检测网
北易三轮摩托车有限公司
关于我们 | 代理申请 | 付款方式 | 客户管理 | 友情链接 | 网站导航

版权所有 2008 三易网络(郑州)科技开发有限公司
服务热线:0371-63653120   63658758 地址:郑州市金水区丰庆路2号
QQ在线客服: 757700863  335050586   Email:web@68cwd.com
http://www.68cwd.com http://www.zdwx.com.cn http://www.zdwx.com

豫ICP备06008228号