Having problems with Timestampdiff

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shishir

    Having problems with Timestampdiff

    The sql
    select TIMESTAMPDIFF(1 ,CHAR(TIMESTAMP ('2001-09-29-11.25.42.483219 ') -
    TIMESTAMP('2001-09-26-12.07.58.065497 '))) from sysibm.sysdummy 1
    works in db2 8.1.2/RHEL 2.1
    but gives the error
    DB2 SQL error: SQLCODE: -443, SQLSTATE: 38552, SQLERRMC:
    SYSFUN.TIMESTAM PDIFF;TIMESTAMP DIFF;SYSFUN:03
    on db2 8.2/RHEL 3

    Any pointers?
    Regards
    Shishir

  • Jan M. Nelken

    #2
    Re: Having problems with Timestampdiff

    Shishir wrote:[color=blue]
    > The sql
    > select TIMESTAMPDIFF(1 ,CHAR(TIMESTAMP ('2001-09-29-11.25.42.483219 ') -
    > TIMESTAMP('2001-09-26-12.07.58.065497 '))) from sysibm.sysdummy 1
    > works in db2 8.1.2/RHEL 2.1
    > but gives the error
    > DB2 SQL error: SQLCODE: -443, SQLSTATE: 38552, SQLERRMC:
    > SYSFUN.TIMESTAM PDIFF;TIMESTAMP DIFF;SYSFUN:03
    > on db2 8.2/RHEL 3
    >
    > Any pointers?
    > Regards
    > Shishir
    >[/color]

    Function TIMESTAMPDIFF returns an INTEGER (signed INTEGER) representing number
    of units (units selected by value of first argument) in the Timestamp Duration
    represented by second argument.

    In your case first argument is 1 - which represents microseconds, second
    argument is timestamp duration of 2231744.417722 seconds.
    Convertion of this duration to microseconds and storing result into an INTEGER
    is impossible.

    Jan M. Nelken

    Comment

    Working...