How to import data from csv to Oracle using sqllder

Source: Internet
Author: User

When Oracle is a beginner, We need to import data to the Oracle database in many ways. This section describes how to import data from csv to Oracle through sqllder. Let's learn it together.
1. Add a CSV file to Oracle. Add data to tables on my Oracle server. Before proceeding to the final operation, create the text file input. ctl in the directory where prize_vs.csv is located. The content is:

 
 
  1. Load data
  2. Infile 'Prize_VS.csv'
  3. Append into table solution name. Prize_VS
  4. Trailing nullcols
  5. (NAME terminated ",",
  6. IDCARD terminated ",",
  7. ADDREASS terminated ",",
  8. POSTALCODE terminated ",")

After saving, run the sqlldr command in the directory where input. ctl is located in DOS mode:

 
 
  1. Sqlldr user name/password @ service nameControl=Input. Ctl
  2.  

After OK, you can see the specific execution records in the input. log file. If there is any problem, the data is concentrated in Prize_VS.bad. You can continue the previous operation after modification until you are satisfied.

Ii. When using sqllder to import a csv file, if the value of a column comes from sequence, how should I specify the value of this column during import?

For example, sqllder is used to import data from the csv file to the Table test. test has three columns: field_a, field_ B, and field_c. The value of field_c comes from sequence_field_c; the control file can be written as follows:

 
 
  1. LOAD DATA   
  2. INFILE 'C:\test.csv '   
  3. TRUNCATE INTO TABLE test  
  4. FIELDS TERMINATED BY ', '   
  5. (field_a, field_b, field_c "sequence_field_c.nextval")   

The above describes how to import data from csv to Oracle using sqllder. It is helpful to input data.

  1. Code required to modify the Oracle Stored Procedure
  2. Summary of Oracle stored procedures
  3. Code for implementing the Oracle Stored Procedure
  4. In-depth high-performance dynamic Oracle SQL Development
  5. Analysis of Oracle SQL optimization rules

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.