Excel data Import Export Database

Source: Internet
Author: User

The first method:

First save Excel as a. csv format file, such as Test.csv, and then write a insert.ctl
Use SQLLDR to import!

Insert.ctl content is as follows:
Load data--1, control file ID
InFile ' My.csv '--2, the data file to be entered is named My.csv
Append into table "Tbl_test"--3, append records to tables table_name
    Fields terminated by ', '--4, field terminated ', ', is a comma (CSV used to differentiate with great limitations, such as in a column of your Excel) tragedy
(Field1,
Field2,
Field3,
FIELDN)-----Define the order of the columns

Save Excel as a. txt format file, such as My.txt, and then write a insert.ctl (virtual special note TXT file encoding method to avoid garbled)
Use SQLLDR to import!

Load data--1, control file ID
InFile ' My.txt '--2, the data file to be entered is named Test.txt
Append into table Test--3, append record to form test
    Fields terminated by X ' 09 '--4, field terminated by X ' 09 ', is a tab (tab)
(ID,USERNAME,PASSWORD,SJ)-----Define the order of columns

Summary

  If your data format data is neat and tidy, it's good to use both of these methods.

The second way:

Also start the condition, Excel save as TXT or CSV, note the TXT code.

Use Plsql Import function, Tool-->text importer. The data from Textfile file in the upper left-hand corner indicates that your TXT file is specified by the Open data file. Then go to the tab tag Data to Oracle and select your owner table. Click on the import data in the lower left corner of the large time will appear suspended animation, please wait patiently.

Summarize:

 when the saved TXT file format is not very good, it is easy to cause, the inserted data will be strung ,

Example: My.txt

exam_id exam_xm exam_xb exam_ly exam_xx exam_bj
01050704 袁珏, West end of Sichuan
00751309 Jiang Pengyi Cheng Nan Sichuan Yilong Revival Secondary school Yilong revival Secondary School
00711028 Yan mi women Sichuan Yilong Revival Secondary school Yilong revival Secondary School
00710908 excitements male Sichuan Yilong Revival Secondary school Yilong revival Secondary School
999900005221 Yin-Yun women Hebei Hebei Province Experimental Middle School 23

Sometimes when inserting a database, the gender is inserted into the wrong column.

The Third Way:

Using a third-party tool, I am using Oracle, using NAVICAT for Oracle, first set up the table, right-click Import Wizard to fix.

Highly recommended.

Source: http://www.cnblogs.com/Feeling-always-wrong/
This article is copyright to the author, welcome reprint, but without the consent of the author must retain this paragraph statement, and in the article page obvious location to the original link.

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.