c shell脚本中的Sqlldr错误

时间:2011-07-22 16:11:00

标签: sql oracle shell sql-loader

我在我的c shell脚本中这样做..我的结果设置为2而不是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

这是我的日志信息,我没有看到任何警告..有人可以帮我这个..谢谢

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

1 个答案:

答案 0 :(得分:2)

根据Orafaq website,返回码2表示警告条件。在您的情况下,这是由于WHEN子句失败而丢弃记录。从网站上,有4个可能的级别:

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

你可能想要考虑2和0的成功结果。

我没有在很长一段时间内完成CShell,但这样的事情可能是:

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