Hi,
I've a question concerning DB/2, dates and Java-binding-Variables:
CASE WHEN MC.fixed_date_dat IS NULL
THEN ? + MC.rel_shift_NR DAY
ELSE MC.fixed_date_dat END
The ? is a binding variable I want to use. If I try to prepare the
statement, I receive a SQL0418N-SQL-error.
Any ideas?
Thanks in advance,
Sascha
Lennart - 27 Jun 2007 17:10 GMT
> Hi,
>
[quoted text clipped - 11 lines]
> Thanks in advance,
> Sascha
DB2 doesnt know the type of your parameter. Try
CASE WHEN MC.fixed_date_dat IS NULL
THEN cast(? as date) + MC.rel_shift_NR DAY
ELSE MC.fixed_date_dat END
or whatever type ? is
HTH
/Lennart
Tonkuma - 28 Jun 2007 01:51 GMT
> CASE WHEN MC.fixed_date_dat IS NULL
> THEN cast(? as date) + MC.rel_shift_NR DAY
> ELSE MC.fixed_date_dat END
I think this can be written simpler.
COALESCE(MC.fixed_date_dat, cast(? as date) + MC.rel_shift_NR DAY)