1

我在我的 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
4

1 回答 1

2

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

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

您可能希望将 2 与 0 一起视为成功的结果。

我很久没有做过 CShell,但可能是这样的:

if ($RESULT != 0 && $RESULT != 2) then
于 2011-07-22T16:48:16.753 回答