I am trying to load a bunch of Java files into a staging table using SQL Loader. I keep getting the subject line error and I'm not sure why.
My executable file that I am trying to run looks like this.
for i in `find <files in certain directory.java>`
do
echo "File name = ${i}"
COMMAND='sed'; ARG='s/XXXX/${i}/'
echo $COMMAND '; ' $ARG
cat test_load.ctl | $COMMAND "$ARG" > test_load_2.ctl
sqlldr <user>/<password> control=test_load_2.ctl log=<file_name>.log
done
My test_load.ctl file looks like this:
I'm trying to replace the XXXX INFILE with the looped through files in the Java directory above.
LOAD DATA
INFILE 'XXXX'
BADFILE '/<directory>/<filename>.bad'
DISCARDFILE '/<directory>/<filename>.dsc'
APPEND INTO TABLE "<SCHEMA>"."<TABLE_NAME>"
TRAILING NULLCOLS
(
id sequence (1, 1),
raw_string position (1:4000) char(4000),
file_name,
dir_path,
load_date sysdate,
line_number sequence (1, 1)
)
My test_load_2.ctl file looks like this:
LOAD DATA
INFILE '${i}'
BADFILE '/<directory>/<filename>.bad'
DISCARDFILE '/<directory>/<filename>.dsc'
APPEND INTO TABLE "<SCHEMA>"."<TABLE_NAME>"
TRAILING NULLCOLS
(
id sequence (1, 1),
raw_string position (1:4000) char(4000),
file_name,
dir_path,
load_date sysdate,
line_number sequence (1, 1)
)
I keep getting this error:
SQL*Loader-503: Error appending extension to file ()
Additional information: 7217
I'm pretty sure there is an issue with the INFILE parameter in the test_load_2.ctl file, but I am not 100% certain how to fix this?
Also I'm probably doing something wrong in the executable file as well.
Any suggestions?
Thank you!