Innovit
Innovit

Reputation: 103

Oracle Char exceeds 255

Is it possible to create a table in Oracle with Char(300)? I read around and found this

"..The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value from 0 to 255.."

but I found that there are those created with CHAR(500). I am having an issue with "Field in data file exceeds maximum length" and the string to insert length is 499.

EDIT: The content of the control file:

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"
)

Upvotes: 0

Views: 573

Answers (1)

ntalbs
ntalbs

Reputation: 29448

Well, the length of CHAR in oracle can be between 1 and 2000 bytes. Perhaps you want to read this oracle documentation page.

Anyway, if the data have variable length, you should consider using VARCHAR2 instead of CHAR. When the data is shorter than specified column length, it will fill the length with spaces.

Upvotes: 4

Related Questions