0

Example row: |(null)|"2011-03-01"|""| (Note: | separated)

Tried below syntaxes in my ctl file, but none of these worked. From DB2 I get (null)'s in txt file. Because while exporting, employee chose (null) as blanks instead of blank in a tool named AQT. I should sense this and make them NULL. After some research, I tried below 2 but none of them worked.

a) MINQUANTITY NULLIF MINQUANTITY = '(null)'

b) MINQUANTITY "decode(:MINQUANTITY,'(null)',NULL,:MINQUANTITY)",

The question is what should I write in my ctl file to sense this (null) ?

meijuh
  • 1,067
  • 1
  • 9
  • 23
Lyrk
  • 1,936
  • 4
  • 26
  • 48
  • Check the answers to these SO questions: http://stackoverflow.com/questions/33433661/nullif-in-sql-loader-to-compare-a-string-value and http://stackoverflow.com/questions/18143888/how-to-use-to-number-and-nullif-in-sql-loader – alexs Jan 05 '17 at 11:43

1 Answers1

0

Try this as it is the correct syntax for for setting the column to NULL when there are blanks in the data file:

MINQUANTITY  NULLIF(MINQUANTITY=BLANKS)
Gary_W
  • 9,933
  • 1
  • 22
  • 40