csv:comma-separated values (comma-separated values) are abbreviations for multiple-line text files with comma-delimited fields Sqlldr are sql*loader abbreviations, After installing the full version of the Oracle client, this tool uses SQLLLDR to import regular text data (such as CSV) into the datasheet Import Example: Import a CSV text file andon.txt into a Testandon table in manpowertest Testandon table structure CREATE TABLE Testandon
(
Build_no VARCHAR2 (5),
Device_no VARCHAR2 (5),
Btn_no VARCHAR2 (5),
Flag VARCHAR2 (1),
Data_time Date--This is the time format for special handling when importing
)1.Create a. CTL import control file with Notepad or other text software, where C:\andon.ctl is the example ofOPTIONS (skip=1)-Skips over 1 lines, that is, skipping the first row of the CSV file header does not import
Load data
InFile ' C:\andon.txt '--the path of the CSV text to import
Append into table Manpowertest.testandon--which table to import into the database
Field terminated by ","--the text to be imported is delimited by what symbol, here is the comma
(Build_no,--which fields to import into the table
Device_no,
Btn_no,
Flag
Data_time timestamp "Yyyy-mm-dd hh24:mi:ss"--format conversion with timestamp "Yyyy-mm-dd hh24:mi:ss" because the field type in the datasheet is a date type, not a literal type )
2.Execute the SQLLDR command in cmd as follows Sqlldr Userid=manpowertest/[email protected] Control=c:\andon.ctl Log=c:\andon.log
Archive 1:andon.txt
Building number, device number, button code, switch status, trigger time
a2-1,4,2,1,2014-10-29 15:14:13
a2-1,30,2,0,2014-10-29 14:51:36
a2-2,10,2,0,2014-10-29 14:18:53
a2-2,11,2,0,2014-10-29 15:11:07
a2-2,12,2,0,2014-10-29 14:40:13
Archive 2:andon.ctl
OPTIONS (Skip=1)
Load data
InFile ' C:\andon.txt '
Append into table Manpowertest.testandon
Fields terminated by ","
(Build_no,
Device_no,
Btn_no,
Flag
Data_time timestamp "Yyyy-mm-dd hh24:mi:ss")
Sample instructions for importing data to an Oracle database table using the SQLLDR command