Sqlloader export Excel data to Oracle
1. Create Sql*loader input data required by the file, are saved to C:\, edited in Notepad:
Control file: Input.ctl, the contents are as follows:
Load data--1, control file identification
InFile ' Test.txt '--2, the data file to enter is named Test.txt
Append into table Test--3, append records to table test
Fields terminated by X ' 09 '--4, field terminated by X ' 09 ', is a tab character (tab)
(ID,USERNAME,PASSWORD,SJ)-----Define column Correspondence order
A, insert, by default, requires the table to be empty at the beginning of the data load
b, append, append new records to the table
c, replace, delete old records, replace the new Loaded records
D, Truncate, ditto
Using the Sql*loader command to implement data entry in a DOS window
C:\>sqlldr Userid=system/manager Control=input.ctl
The default log file name is: Input.log
Default bad record file is: Input.bad
2. There is another way
You can save the Excel file as a CSV (comma-delimited) (*.csv), and the control file is separated by a comma
LOAD DATA
INFILE ' D:\car.csv '
APPEND into TABLE t_car_temp
FIELDS terminated by ","
(Phoneno,vip_car)
Import data directly in the control file
1, the control document TEST.CTL content
--The format for executing this file and SQL Loader is:
--Sqlldr control=<filename> is sure to substitute your
--version of SQL LOADER and the filename for this file.
LOAD DATA
INFILE *
Badfile ' C:\Documents and settings\jackey\ desktop \wmcountry. Bad '
Discardfile ' C:\Documents and settings\jackey\ desktop \wmcountry. DSC '
INSERT into TABLE emccountry
Fields terminated by ";" Optionally enclosed by ' "'
(
Countryid Nullif (countryid= "NULL"),
CountryCode,
CountryName,
Continentid Nullif (continentid= "NULL"),
MAPID Nullif (mapid= "NULL"),
Createtime DATE "mm/dd/yyyy HH24:MI:SS" Nullif (createtime= "NULL"),
Lastmodifiedtime DATE "mm/dd/yyyy HH24:MI:SS" Nullif (lastmodifiedtime= "NULL")
)
Begindata
1; " JP ";" Japan "; 1;9;" 09/16/2004 16:31:32 "; Null
2; " CN ";" "1;10;" 09/16/2004 16:31:32 "; Null
3; " In ";" India "; 1;11;" 09/16/2004 16:31:32 "; Null
4; " AU ";" Australia "; 6;12;" 09/16/2004 16:31:32 "; Null
5; " CA ";" Canada "; 4;13;" 09/16/2004 16:31:32 "; Null
6; " US ";" United States "; 4;14;" 09/16/2004 16:31:32 "; Null
7; " MX ";" Mexico "; 4;15;" 09/16/2004 16:31:32 "; Null
8; " GB ";" United kingdom "; 3;16;" 09/16/2004 16:31:32 "; Null
9; " DE ";" Germany "; 3;17;" 09/16/2004 16:31:32 "; Null
10; " FR ";" France "; 3;18;" 09/16/2004 16:31:32 "; Null
11; " IT ";" Italy "; 3;19;" 09/16/2004 16:31:32 "; Null
12; " ES ";" Spain "; 3;20;" 09/16/2004 16:31:32 "; Null
13; " FI ";" Finland "; 3;21;" 09/16/2004 16:31:32 "; Null
14; " SE ";" Sweden "; 3;22;" 09/16/2004 16:31:32 "; Null
15; " IE ";" Ireland "; 3;23;" 09/16/2004 16:31:32 "; Null
16; " NL ";" Netherlands "; 3;24;" 09/16/2004 16:31:32 "; Null
17; " DK ";" Denmark "; 3;25;" 09/16/2004 16:31:32 "; Null
18; " BR ";" Brazil "; 5;85;" 09/30/2004 11:25:43 "; Null
19; " KR ";" Korea, Republic of "; 1;88;" 09/30/2004 11:25:43 "; Null
20; " NZ ";" New Zealand "; 6;89;" 09/30/2004 11:25:43 "; Null
21; " Be ";" Belgium "; 3;79;" 09/30/2004 11:25:43 "; Null
22; " At ";" Austria "; 3;78;" 09/30/2004 11:25:43 "; Null
23; " NO ";" Norway "; 3;82;" 09/30/2004 11:25:43 "; Null
24; " LU ";" Luxembourg "; 3;81;" 09/30/2004 11:25:43 "; Null
25; " PT ";" Portugal "; 3;83;" 09/30/2004 11:25:43 "; Null
26; " GR ";" Greece "; 3;80;" 09/30/2004 11:25:43 "; Null
27; " IL ";" Israel "; 1;86;" 09/30/2004 11:25:43 "; Null
28; " CH ";" Switzerland "; 3;84;" 09/30/2004 11:25:43 "; Null
29; " A1 ";" Anonymous Proxy "; 0;0;" 09/30/2004 11:25:43 "; Null
30; " A2 ";" Satellite Provider "; 0;0;" 09/30/2004 11:25:43 "; Null
31; " AD ";" Andorra "; 3;0;" 09/30/2004 11:25:43 "; Null
32; " AE ";" United Arab Emirates "; 1;0;" 09/30/2004 11:25:43 "; Null
33; " AF ";" Afghanistan "; 1;0;" 09/30/2004 11:25:43 "; Null
34; " AG ";" Antigua and Barbuda "; 7;0;" 09/30/2004 11:25:43 "; Null