oracle ebcdic sqlldr问题

时间:2018-12-07 23:16:19

标签: sql oracle sql-loader ebcdic

我对如何将EBCDIC文件加载到Oracle表中存在疑问。我已经阅读了许多有关该问题的主题。但是,我似乎仍然无法取得进步。

基于COBOL副本给我的定义,我构建了如下控制文件:EBCDIC.ctl

LOAD DATA
    CHARACTERSET WE8EBCDIC500
    INFILE 'File.ebc' "fix 45"
    BADFILE 'File.bad'
    DISCARDFILE 'File.dis'
    INTO TABLE test.ETEST APPEND TRAILING NULLCOLS
    (
    recordone   POSITION(0001:0010)     INTEGER EXTERNAL,
    recordtwo   POSITION(0011:0015)     CHAR,
    recordthree     POSITION(0016:0020)     INTEGER EXTERNAL,
    recordfour      POSITION(0021:0030)     DATE,
    recordfive  POSITION(0031:0040)     CHAR "TO_NUMBER(:recordfive,'99999999.99')",
    recordsix   POSITION(0041:0045)     INTEGER EXTERNAL
)

我在Oracle中的表是通过以下方式定义的:

CREATE TABLE ETEST
(
    recordone               NUMBER(10),
    recordtwo       VARCHAR2(5),
    recordthree     NUMBER(5),
    recordfour      DATE,
    recordfive              NUMBER(10,2),
    recordsix               NUMBER(5),
)
TABLESPACE users STORAGE ( INITIAL 50K);

这是我用来运行SQLLDR的语法:

sqlldr userid=test/test control=EBCDIC.ctl

由于我无法访问Intranet之外的EBCDIC文件,并且我想在个人笔记本电脑上进行一些测试,因此我使用以下记录构建了EBCDIC记录:

6234598345
ASDFD
34524
sysdate
50000000.00
74564

在以下网站(不确定该网站的信誉)https://www.browserling.com/tools/text-to-ascii上,我转换了这些值

6234598345ASDFD34524sysdate50000000.0074564

到ASCII:

54 50 51 52 53 57 56 51 52 53 65 83 68 70 68 51 52 53 50 52 115 121 115 100 97 116 101 53 48 48 48 48 48 48 48 46 48 48 55 52 53 54 52 10

我在SQLLDR的末尾添加了'10'作为换行符。然后,我在以下站点https://shop.alterlinks.com/ascii-ebcdic-conversion/ascii-ebcdic-conversion-us.php上将ASCII转换为EBCDIC,这给了我:

õô@õð@õñ@õò@õó@õ÷@õö@õñ@õò@õó@öõ@øó@öø@÷ð@öø@õñ@õò@õó@õð@õò@ññõ@ñòñ@ññõ@ñðð@ù÷@ññö@ñðñ@õó@ôø@ôø@ôø@ôø@ôø@ôø@ôø@ôö@ôø@ôø@õõ@õò@õó@õô@õò@ñð

我使用以下INSERT语句确保这些值将加载到数据库表ETEST

insert into etest values (6234598345, 'ASDFD', 34524, sysdate, 50000000.00, 74564)

我在日志文件中不断获得以下输出:

Table TEST.ETEST, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect

Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
RECORDONE                            1:10    10           CHARACTER
RECORDTWO                           11:15     5           CHARACTER
RECORDTHREE                         16:20     5           CHARACTER
RECORDFOUR                          21:30    10           DATE DD-MON-RR
RECORDFIVE                          31:40    10           CHARACTER
SQL string for column : "TO_NUMBER(:recordfive,'99999999.99')"
RECORDSIX                           41:45     5           CHARACTER

Record 1: Rejected - Error on table TEST.ETEST, column RECORDONE.
ORA-01722: invalid number

Record 2: Rejected - Error on table TEST.ETEST, column RECORDONE.
ORA-01722: invalid number

Record 3: Rejected - Error on table TEST.ETEST, column RECORDONE.
ORA-01722: invalid number

Record 4: Rejected - Error on table TEST.ETEST, column RECORDONE.
ORA-01722: invalid number

Record 5: Rejected - Error on table TEST.ETEST, column RECORDONE.
ORA-01722: invalid number

SQL*Loader-501: Unable to read file (File.ebc)
SQL*Loader-566: partial record found at end of datafile
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
Specify SKIP=5 when continuing the load.

任何人都可以帮助我了解我的原因:首先:“ ORA-01722:无效号码”错误;其次,为什么SQLLDR认为文件中有五个记录;第三,为什么我看到“ SQL * Loader-566:在数据文件末尾找到部分记录”?

谢谢!

0 个答案:

没有答案