To XML in Oracle

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

 1

Convert .xls to .csv. Open .xls in MS Excel. Delete any Column Headers. Go to "File, "Save As"
and change "Type" to .csv format. Provide a new path and name and click "Save."

 2

Create the Control File. Open Notepad. Type the following and save as "...\filename.ctl."

OPTIONS (ROWS=1, LOG='...\filename_load.log')

LOAD DATA

INFILE '...\filename.csv'

INTO TABLE TABLENAME

FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'

TRAILING NULLCOLS

(FIELD1, FIELD2, FIELD3, FIELDx TERMINATED BY WHITESPACE)

Tablename is the name of your Oracle table, "....\" represented by the fully qualified path where
your files reside, "filename_load.log" is the log file to confirm success or indicate processing
errors and "FIELDS1...x" are the names of the .csv columns in order from left to right.

 3

Create an Oracle table, if necessary. At the Oracle SQL prompt, type or execute a file containing:

CREATE TABLE TABLENAME(

FIELD1 (plus field format ex: VARCHAR2(30),

FIELD2 (plus field format ex: VARCHAR2(30),

FIELD3 (plus field format ex: VARCHAR2(30),

FIELDx (plus field format ex: VARCHAR2(30));


"FIELDS" here must match in name and order the fields in the Step Two Control File. The
control file will match each .csv column into it's corresponding Oracle table column.

 4

Execute the Sqlldr.exe. Find Sqlldr.exe. (Ex: C:\Oracle\product\10.1.0\Client_1\BIN\sqlldr.exe.)


Open Notepad, type the path: .../sqlldr.exe user/password@service_name
control='.../filename.ctl.'

Save as filename.bat and double-click to execute

Read more: How to Import Xls Into Oracle | eHow.com


http://www.ehow.com/how_7300405_import-xls-oracle.html#ixzz14m6d0Dlw

You might also like