Oracle Char超过255

时间:2014-04-24 02:47:34

标签: oracle

是否可以使用Char(300)在Oracle中创建表?我四处看看,发现了这个

  

“.. CHAR列的长度固定为您声明的长度   当你创建表时。长度可以是0到0之间的任何值   255 ..“

但我发现有些是用CHAR(500)创建的。我遇到“数据文件中的字段超过最大长度”的问题,并且要插入长度的字符串是499。

编辑:控制文件的内容:

options(skip=1,errors=999999,readsize=61640000,bindsize=61640000,rows=2000)
Load data
infile 'Hours_04.csv'
badfile 'Hours_04.bad'
truncate
into table XD_Hours
fields terminated by ";"  ENCLOSED BY '"' 
(   Name char,
    wdate Date "yyyy-mm-dd",
    hours decimal external,
    descr char(500),
    app char,
    hourstype,
    task Integer external,
    subproject Integer external,
    project Integer external,
    function char,
    organization char,
    fgroup char,
    HrsMod Date "yyyy-mm-dd"
)

1 个答案:

答案 0 :(得分:4)

嗯,oracle中CHAR的长度可以在1到2000个字节之间。也许你想阅读这个oracle documentation page

无论如何,如果数据的长度可变,您应该考虑使用VARCHAR2而不是CHAR。当数据短于指定的列长度时,它将用空格填充长度。

相关问题