How to use to_number and nullif in sql-loader?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 00:29:28

Your NULLIF condition should not be inside the double-quotes for the SQL string; and it needs to come first. From the documentation:

  • The SQL string appears after any other specifications for a given column.

  • The SQL string must be enclosed in double quotation marks.

...

  • The SQL string is evaluated after any NULLIF or DEFAULTIF clauses, but before a date mask.

So it should be:

MINQUANTITY NULLIF MINQUANTITY = '.'
  "TO_NUMBER(:MINQUANTITY, '9999999999D999999', 'NLS_NUMERIC_CHARACTERS='',.''')"

(You can split into two lines for readability, both parts still apply to the `MINQUANTITY field).

In the log that's reported as:

MINQUANTITY                          NEXT     *   ,       CHARACTER
    NULL if MINQUANTITY = 0X2e(character '.')
    SQL string for column : "TO_NUMBER(:MINQUANTITY, '9999999999D999999', 'NLS_NUMERIC_CHARACTERS='',.''')"

(Have you got your NLS chars the right way round? This is treating , as the decimal separator, while your question suggests you're using .. Either will work as long as the value is enclosed in double-quotes, of course).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!