Dates, DB/2 and Java

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sascha.Moellering@gmail.com

    #1

    Dates, DB/2 and Java

    Hi,

    I've a question concerning DB/2, dates and Java-binding-Variables:

    CASE WHEN MC.fixed_date_d at IS NULL
    THEN ? + MC.rel_shift_NR DAY
    ELSE MC.fixed_date_d at 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

    #2
    Re: Dates, DB/2 and Java

    Sascha.Moelleri ng@gmail.com wrote:
    Hi,
    >
    I've a question concerning DB/2, dates and Java-binding-Variables:
    >
    CASE WHEN MC.fixed_date_d at IS NULL
    THEN ? + MC.rel_shift_NR DAY
    ELSE MC.fixed_date_d at 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_d at IS NULL
    THEN cast(? as date) + MC.rel_shift_NR DAY
    ELSE MC.fixed_date_d at END

    or whatever type ? is

    HTH
    /Lennart

    Comment

    • Tonkuma

      #3
      Re: Dates, DB/2 and Java

      CASE WHEN MC.fixed_date_d at IS NULL
      THEN cast(? as date) + MC.rel_shift_NR DAY
      ELSE MC.fixed_date_d at END
      I think this can be written simpler.
      COALESCE(MC.fix ed_date_dat, cast(? as date) + MC.rel_shift_NR DAY)

      Comment

      Working...