467,209 Members | 1,293 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,209 developers. It's quick & easy.

Dates, DB/2 and Java

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

Jun 27 '07 #1
  • viewed: 1330
Share:
2 Replies
Sa***************@gmail.com wrote:
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
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
Jun 27 '07 #2
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)

Jun 28 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Firewalker | last post: by
5 posts views Thread by DJ Craig | last post: by
5 posts views Thread by krishnakant Mane | last post: by
9 posts views Thread by sha2484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.