By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,004 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,004 IT Pros & Developers. It's quick & easy.

Dates, DB/2 and Java

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.