Sqlldr Load file, ORA-01722: invalid number Solution

Source: Internet
Author: User

Sqlldr Load file, ORA-01722: invalid number solve dos2unix file: convert file into unix mode (internal for text) Case: csv file sqlldr. control File load datainto table totofields terminated by ',' (BALL_No, MAIN_BALL_FREQUENCY, ADDITIONAL_NO_FREQUENCY) sqlldr. A csv file/s01/sqlldr/toto.csv sqlldr k24/k24control = sqlldr. control log = toto. log problem: failed to import logs. View toto. log Record 1: Rejected-Error on table K24.TOTO, column ADDITIONAL_NO_FREQUENCY. ORA-01 722: invalid number: this error is reported on each row. cause: the last column of the table imported by sqlldr is the number type, and the csv file is also a number. An error is returned for an invalid number, then I have a reason to suspect that there is a carriage return character at the end of each line in the csv file (this is available in the text format in windows). Test Solution: 1. alter table toto modify ADDITIONAL_NO_FREQUENCY varchar2 (20 ); execute sqlldr again and find that the data is successfully imported. This conclusion proves that, at the end of the csv text that is full of numbers, there is something that is not a number, then only the carriage return character 2、dos2unixto.csv will be used (this command will convert the text in windows to the text in linux format, which is actually to remove the carriage return character). 3. Clear the data in toto first, then, change the last column format to alter table toto modify ADDITIONAL_NO_FREQUENCY numbe. R; execute sqlldr again. Select table, it is found that the import is successful. Changed the control fileLOAD DATAINFILE 'toto.csv 'badfile' toto. bad 'appendinto TABLE totoTRAILING NULLCOLS (BALL_NO integer external terminated by ',', MAIN_BALL_FREQUENCY integer external terminated by ',', ADDITIONAL_NO_FREQUENCY integer external terminated by whitespace)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.