Jack
Jack

Reputation: 805

Sqlldr error in c shell script

I am doing this in my c shell script.. my result is set to 2 rather than 0

sqlldr $ORA_UID/$ORA_PSWD,control=$CTL/${controlfile}.CTL,log=${sqllog},bad=${badlog},DATA=${filename},discard
=${dsclog}

set RESULT = $status

if ($RESULT != 0) then
  echo "Check sql log file"
  exit 1
endif

here is my log info i dont see any warning.. can someone help me with this.. thank you

Table "BA"."TABLE1":
  25 Rows successfully loaded.
  0 Rows not loaded due to data errors.
  40785 Rows not loaded because all WHEN clauses were failed.
  0 Rows not loaded because all fields were null.


Table "BA"."TABLE1":
  19147 Rows successfully loaded.
  0 Rows not loaded due to data errors.
  21663 Rows not loaded because all WHEN clauses were failed.
  0 Rows not loaded because all fields were null.


Table "BA"."TABLE1":
  16588 Rows successfully loaded.
  0 Rows not loaded due to data errors.
  24222 Rows not loaded because all WHEN clauses were failed.
  0 Rows not loaded because all fields were null.


Space allocated for bind array:                 252324 bytes(43 rows)
Read   buffer bytes: 1048576

Total logical records skipped:          0
Total logical records read:         40810
Total logical records rejected:         0
Total logical records discarded:     5050

Upvotes: 1

Views: 1812

Answers (1)

DCookie
DCookie

Reputation: 43523

According to the Orafaq website, a return code of 2 indicates a Warn condition. In your case, this is due to records being discarded due to WHEN clause failures. From the website, there are 4 possible levels:

0 - successful 
1 - failed 
2 - warn 
3 - fatal 

You'll probably want to consider 2 a successful outcome along with 0.

I haven't done CShell in a LONG time, but something like this maybe:

if ($RESULT != 0 && $RESULT != 2) then

Upvotes: 2

Related Questions