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:
- Load data
- Infile 'Prize_VS.csv'
- Append into table solution name. Prize_VS
- Trailing nullcols
- (NAME terminated ",",
- IDCARD terminated ",",
- ADDREASS terminated ",",
- POSTALCODE terminated ",")
After saving, run the sqlldr command in the directory where input. ctl is located in DOS mode:
- Sqlldr user name/password @ service nameControl=Input. Ctl
-
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:
- LOAD DATA
- INFILE 'C:\test.csv '
- TRUNCATE INTO TABLE test
- FIELDS TERMINATED BY ', '
- (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.
- Code required to modify the Oracle Stored Procedure
- Summary of Oracle stored procedures
- Code for implementing the Oracle Stored Procedure
- In-depth high-performance dynamic Oracle SQL Development
- Analysis of Oracle SQL optimization rules