Loading text data into Oracle with SQL*Loader

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

    By submitting your registration information to SearchOracle.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchOracle.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.