The column in database is a varchar(25). But sometimes my datafile has data for this column exceeding 25. I want the SQLloader to take the first 25 characters and load them into the database. I am using a control file, variable-length delimited by |, so I can not mention positions for all the fields, this field represents 40th column in database (total 50 columns). Is there any way to specify to pick the first 25 characters? Yes. You...
can do this. The way to accomplish this task is to apply an SQL operator to your field. To use just the first 25 characters, you will want to use the SUBSTR function on the input data. Something similar to the following can help:
LOAD DATA INFILE * APPEND INTO TABLE XXX ( LAST position(1:7) char "UPPER(:LAST)" FIRST position(8:45) char "SUBSTR(:FIRST,1,25)" )
The above is just a portion of what you control file might look like. I've foced the data that will go into the LAST column to be all upper case and I've forced the data to be placed into the FIRST column to be just the first 25 characters of the data.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.