oracle - How to use to_number and nullif in sql-loader? -
i've had similar problem dates (combination of to_date , nullif) here : how use decode in sql-loader?
and solved nicely.
my problem numeric field in csv file can have these formats : 999,999,999.99 or dot '.' null values.
this working :
minquantity "to_number(:minquantity, '9999999999d999999', 'nls_numeric_characters='',.''')"
or
minquantity nullif minquantity = '.'
but not working when i'm trying combine both :
minquantity "to_number(:minquantity, '9999999999d999999', 'nls_numeric_characters='',.''') nullif :minquantity= '.'"
here error log :
record 1: rejected - error on table my_table, column minquantity. ora-00917: missing comma
how can combine these ?
your nullif
condition should not inside double-quotes sql string; , needs come first. the documentation:
the sql string appears after other specifications given column.
the sql string must enclosed in double quotation marks.
...
- the sql string evaluated after nullif or defaultif clauses, before date mask.
so should be:
minquantity nullif minquantity = '.' "to_number(:minquantity, '9999999999d999999', 'nls_numeric_characters='',.''')"
(you can split 2 lines readability, both parts still apply `minquantity field).
in log that's reported as:
minquantity next * , character null if minquantity = 0x2e(character '.') sql string column : "to_number(:minquantity, '9999999999d999999', 'nls_numeric_characters='',.''')"
(have got nls chars right way round? treating ,
decimal separator, while question suggests you're using .
. either work long value enclosed in double-quotes, of course).
Comments
Post a Comment