Examples of SQL loader use in Oracle

Source: Internet
Author: User
Tags sql loader

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

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.