I add a new command line option for my free text unload utility (ociuldr):
table = table name in the sqlldr control file
The default value is NULL, it will not generate SQLLDR control file for you. If you define a value for this option, it will create a file named "{value}_sqlldr.ctl" which contains the SQLLDR instructors, you could use it to load the text file into new database.
C:\TEMP>ociuldr user=anysql/anysql query="select * from tab" table=tab
0 rows exported at 2006-11-16 21:49:12
5 rows exported at 2006-11-16 21:49:12
Now we can check the contents of SQLLDR control file:
C:\TEMP>type tab_sqlldr.ctl
--
-- Generated by OCIULDR
--
OPTIONS(BINDSIZE=4194304,READSIZE=4194304,ERRORS=-1,ROWS=50000)
LOAD DATA
INFILE 'uldrdata.txt' "STR X'0a'"
INTO TABLE tab
FIELDS TERMINATED BY X'2c' TRAILING NULLCOLS
(
TNAME CHAR(30),
TABTYPE CHAR(7),
CLUSTERID CHAR(40)
)
This is very useful improvement, usually we cannot remember correctly how to write SQLLDR control file. I often use this utility now.
The ociuldr binary is avaiable in the zip file, and the latest source code is also available.