Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / June 2007

Tip: Looking for answers? Try searching our database.

Dates, DB/2 and Java

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sascha.Moellering@gmail.com - 27 Jun 2007 16:47 GMT
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)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.