How to load comma seperated values file (*.csv) into Oracle table

Hi all

I need to input values in a .csv file into my Oracle table running in Unix, I wonder what would be the command to do so...

The values are recorded in an excel file and I tried using a formatted text file to do so but failed because one of the field is simply too large to fit in the spreadsheet cell (the info in the cell is 300 char wide but an excel file only permits the cell to be 255 max), if I export the file in formatted text, this field cannot be exported.

Hence I am thinking of converting the excel file into a .csv and ftp to my Unix server and load it in using SQL loader, but I don't know the script to do that.

I am using a HP 9000 machine running HPUX. If you have any other ways of helping me load this data in the table, I'll be ready to do that too!! Thanks!

hi
u can get ur file to unix server by ftp..
then open ur flat data file in vi editor n then replace all commas by some other char like ( | pipe) or something else whichever oracle sql loader recognises..
the comma replace command in vi editor is
press Esc then
:%s/,/|/g (then enter) which shall replace all the occurences of commas by ur selected character (pipe in the above eg.)
I hope this will possibly solve ur problem
bye

Don't post in multiple forums please.

Refer to the Unix for Dummies forum - and provide more info there. I assume you're looking for the syntax to actually load the csv file into the database....I've left a q there for you.

I used SQL loader for effectively writing data from a file into the oracle table running on unix.

The syntax is as follows:

load data
infile 'path of the data file in unix '
insert //append or replace can also be used depending on the
//requirements.
into table table-name
fields terminated by ","
{
column_name position(01:30) char //position specifies
//the length of that field
}

Note: This holds good for records seperated by delimiters. Comma can be replaced by any delimiter.. There is another syntax that has to be used for tab seperated records.

Cheers,
Nisha

If you are loading any text or char fields, make sure that any abbreviations or contractions in the text that make use of the ' character are doubled inside any single quotes or you will have problems importing text.

There was some code posted in the shell programming forum addressing this problem, just in case.