Q

Importing text file to Oracle table

We've been using SQL Server, and now we switched to Oracle. We have to import a text file (delimited with commas) to an Oracle table via our application. Our application tool is Microsoft .NET. Is there any way to import a text file in Oracle via coding?

I am a newbie for the Oracle platform; for the last five years we've been using SQL Server, and now we switched to Oracle. Coming to the point, we have an application in which we have to import a text file (delimited with commas) to an Oracle table via our application. Our application tool is Microsoft .NET. So is there any way to import a text file in Oracle via coding? Earlier we were using BCP (bulk insert utility) in SQL Server. Please suggest an alternative method. Thanks.
If you can place the text file on the database server, then you can use Oracle External Tables to load the data with a simple INSERT..SELECT statement. Assume that I have created an External Table called MY_EXT_TABLE, which is just a pointer to the text file, I can insert the data into MY_TABLE with the following command:
INSERT INTO my_table SELECT * FROM my_ext_table;
For more information on External Tables, read the Oracle Utilities Guide. Part III covers External Tables.

If the text file resides on the client side, then you'll have to install Oracle Client software on the workstation.

This should be OK since you were using "bcp," which requires you to install SQL Server client tools on the workstation. Once you have Oracle Client on the workstation, you can use Oracle's utility for loading text files into a table. This utility is called SQL*Loader. The document I referenced above also covers SQL*Loader in Part II. SQL*Loader can also be used on the database server in lieu of External Tables.

Either solution does essentially the same thing, as both SQL*Loader and External Tables use the same engine to read the contents of the text file.

This was first published in August 2006

Dig deeper on Oracle database design and architecture

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close