Ask the Expert

Loading text data into Oracle with SQL*Loader

I have data in text format and I want to load it into my Oracle database with SQL*Loader. However, I have no idea how to go about it. Could you please send me detailed steps? My RDBMS version is 8.1.6 and OS is Compaq Tru64.

    Requires Free Membership to View

You'll need to use Oracle's SQL*Loader utility to load a text file into a database table. There are many options to SQL*Loader, so a read of the Oracle Utilities Guide is probably a good idea.

How you load the data depends on whether the data is comma delimited, tab delimited, uses special characters, needs additional processing and so on. Once you know these answers, you need to create a control file which describes how to handle all of your options. An example control file to load some data might look like the following:

LOAD DATA
INFILE 'ITS_data.txt'
BADFILE 'ITS_data.bad'
DISCARDFILE 'ITS_data.dsc'
APPEND
INTO TABLE pims_temp
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(wbs_parent,wbs,ffs_account,ffs_account_desc,ffs_subtask_desc,
rescode,resource_name,resdept,type,
hrs_dlrs_ind,month1,month2,month3,month4,month5,month6,month7,month8,month9,
month10,month11,month12)

In this case, the input file is called 'ITS_data.csv'. It will load this data into a table called 'pims_temp'. The input file is a comma delimited file, optionally enclosed with the double quotes.

Without knowing more about your specific requirements, I can't help much more than that. You'll really want to read the chapter on SQL*Loader in the Oracle Utilities Guide.

This was first published in March 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: