cd /d path_to_program_folder
nmake EXE="addlength.exe" OBJS="addlength.obj" CPPFLAGS="/nologo /EHsc /Zi /O2"
c:\github\addlength>nmake EXE="addlength.exe" OBJS="addlength.obj" CPPFLAGS="/nologo /EHsc /Zi /O2"
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl /nologo /O2 /DNDEBUG /c addlength.cpp
addlength.cpp
cl /nologo /O2 /DNDEBUG /Feaddlength.exe addlength.obj
addlength src_file dst_file
c:\github\addlength>addlength LOAD_SAMPLE_en.csv LOAD_SAMPLE.dat Infomation - Completed successfully. Wrote 3 records and 130 bytes in 0.00 seconds. c:\github\addlength>type LOAD_SAMPLE_en.csv "2012/10/21","Newline_is_not_in",85 "2012/11/21","Line_ break_is_before_the_break",86 "2012/12/21","Line_break_is _after_the_is",87 c:\github\addlength>type LOAD_SAMPLE.dat 0000000038"2012/10/21","Newline_is_not_in",85, 0000000053"2012/11/21","Line_ break_is_before_the_break",86, 0000000049"2012/12/21","Line_break_is _after_the_is",87,
c:\github\addlength>type LOAD_SAMPLE.ctl LOAD INFILE "LOAD_SAMPLE.dat" "VAR 10" INTO TABLE "LOAD_SAMPLE" TRUNCATE FIELDS TERMINATED BY ',' TRAILING NULLCOLS ( "C1" DATE "YYYY/MM/DD" ENCLOSED BY '"' , "C2" CHAR ENCLOSED BY '"' , "C3" DECIMAL EXTERNAL )
c:\github\addlength>sqlldr SCOTT/TIGER control=LOAD_SAMPLE SQL*Loader: Release 11.2.0.2.0 - Production on Tue Sep 4 09:37:24 2018 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Commit point reached - logical record count 3
c:\github\addlength>sqlplus SCOTT/TIGER
SQL*Plus: Release 11.2.0.2.0 Production on Tue Sep 4 09:38:44 2018
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
SQL> SET PAGESIZE 1000
SQL> COLUMN C2 FORMAT A10
SQL> select * from LOAD_SAMPLE;
C1 C2 C3
------------------ ---------- ----------
21-OCT-12 Newline_is 85
_not_in
21-NOV-12 Line_ 86
break_is_b
efore_the_
break
21-DEC-12 Line_break 87
_is
_after_the
_is
SQL>
You succeeded in loading.
Through this topic you can see the following.
In addition, the provided data conversion program:addlength.cpp is compatible (automatic identification) to UTF-8 in addition to Shift-JIS and has performance that can withstand practical use even for large amounts of data.
The results of investigating the performance were as follows. The hardware used is the same as that used in the product introduction test.
| Index | Number |
|---|---|
| Number of lines | 100 million |
| Number of bytes | 4.7GB |
| Time required | 95 seconds |
| Data rate | 50.1MBytes/second |
c:\github\addlength>addlength output\F1.dat output\F1.csv Infomation - Completed successfully. Wrote 100000000 records and 5161887577 bytes in 95.04 seconds.
The above is a hard copy of the test screen.
By the way, in our product MTU, if you know that there are string fields including newlines beforehand, you can get the variable record format control file as shown in this topic and CSV data containing the record length can be output.
Since it is often unknown whether a line feed is included in the string field before unloading, the setting to output in variable record format instead of stream record format is set as the factory default value. In addition, fixed record format is also selectable.
The environment variable that controls this behavior is RECLENGTH. It is defined in the env.bat file.
by 開発1号
See previous Loading CSV with newline in the string field (1/2)