暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle sql加载程序加载数据失败

askTom 2016-04-13
143

问题描述

嗨,汤姆,
在表中数据加载过程中出现错误。要求是在将数据加载到表中之前,应使用变量var乘法。请查找我正在执行的以下步骤:

1)以下是表创建查询:
创建表emp_test_temp
(
nmpno数,
搪瓷varchar2(30) ,
作业varchar2(30) ,
销售号码,
通信号
);
2)以下是Datafile即雇员.txt中的记录:

100、Thomas、Sales、5000、300
200、Jason、Technology、5500、500
300、Mayla、Technology、7000、100
400, Nisha, Marketing, 9500, 100
amit, Randy, Technology , 6000, 800
501, Rtu ,会计, 5400, 900

3)下面是编写在批处理文件中的代码,即。用于控制文件和sql加载器命令的test.bat :

@回声开启

设置/p值=

回显加载数据>emp_test_input.ctl
回显infile'E:\emmpyee.txt'>>emp_test_input.ctl
回显截断>>emp_test_input.ctl
回显到表emp_test_temp >>emp_test_input.ctl
回显字段由","终止>>emp_test_input.ctl
回显(>emp_test_input.ctl
回显empno, >>emp_test_input.ctl
回显名字, >>emp_test_input.ctl
回显作业, >>emp_test_input.ctl
回显"to_number(:sal*val), >>emp_test_input.ctl
回显命令"to_number(:sal+:comm)">>emp_test_input.ctl
回声)

sqldr userid=amit/amit控件=emp_test_input.ctl


运行批处理脚本时,会出现以下错误:

E:\>test1.bat
2
)
sql加载器将加载数据

SQL* Loader : 11.2.0.2.0发布- 2016年4月13日星期三生产16:11:24

版权所有(c) 1982, 2009, Oracle和/或其附属公司。保留所有权利。

SQL*Loader-350 :第11行语法错误。
应为","或")",找到文件结尾。


请尽早做需要的事。
先谢了。

专家解答

两件事

1)您的最后一个回显需要重定向到文件
2)运行批处理文件时,生成的ctl文件为:

加载数据
infile'c:\temp\empoyee.txt'
截短
emp_test_temp
","终止的字段
(
恩普诺,
名字,
工作,
Sal "to_number(:sal*val)" ,
com "to_number(:sal+:comm)"
)

因此,您可以看到“阀”没有被正确替换。

请对批处理文件中的该行尝试以下操作:

回显"to_number(:sal*%val%)", >>c:\temp\emp_test_input.ctl


「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论