Export Excel data into the Oracle database using SQL * Loader

xiaoxiao2021-03-06  83

System environment:

1, operating system: Windows 2000 Server, machine memory 128M

2, Database: Oracle 8i R2 (8.1.6) for NT Enterprise Edition

3, installation path: c: / oracle

Implementation steps:

1, open Microsoft Excel 2000

2, File (f) → New (N) → Workbook →

3, enter the following data, the stock is Test.xls, as shown in the figure:

4, File (f) → Save as (a) →

The saving type is: Table symbol separation, named Text.txt, save to C: /

5, connect SQL * Plus

Log in with System / Manager user,

SQL> CONN SYSTEM / MANAGER

Create a table structure

SQL> CREATE TABLE TEST

(

ID Number, - Serial number

Username varchar2 (10), - Username

Password varcha2 (10), - password

SJ VARCHAR2 (20) - Establishment date

);

6. Creating SQL * Loader Entering the files needed to enter the data to be saved to C: /, with Notepad Edit:

Control file: Input.ctl, the content is as follows:

Load Data --1, control file identity

Infile 'Test.txt' --2, the data file to be entered is named Test.txt

Append Into Table Test --3, add a record in Test Test

Fields Terminated by X'09 '--4, field termination in X'09', is a tab (tab)

(ID, username, password, sj) ----- Defining column corresponding order

A, INSERT, for the default mode, the table is empty when the data load is started.

B, append, add new records in the table

C, Replace, delete old records, replace the new load record

D, truncate, the same

7. Use the SQL * loader command to implement data in the DOS window.

C: /> sqlldr userid = system / manager control = input.ctl

Default log file name: Input.log

The default bad log file is: Input.bad

8, connect to SQL * Plus to see if it is successful

转载请注明原文地址:https://www.9cbs.com/read-94378.html

New Post(0)