It's based on Linux. You can make adjustments as you wish. Always check your requirements.
This method, builds a table with the contents of the sqlloader controlfiles.
It has three columns (s1,s2,s3) that contain owner,table_name and sort.
These columns are used for getting the output in the correct order.
When the table is build, you create a second SQL from it, that will run and spool all separate controlfiles.
Things you might want to change are:
- the owner of the schema (now APPOWNER)
- the location where the controlfiles ares spooled to (now /tmp/work)
- the csv delimiter (now a caret symbol ^)
There are five selects in the create table:
- spool /tmp/work/table_name.ctl (lines with s3= -999 )
- -- controlfile: table_name.ctl (s3= -99 )
- load data infile ... into table ... etc. (s3= 0 )
- the columns part, separated by commas and a ) for the last column ( s3 = column_id)
- spool off ( s3 = 999 )
I'd like to hear if you can use this script :-)