View previous topic :: View next topic
|
Author |
Message |
tecnokrat Warnings : 1 Active User
Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
Hi,
I;m trying to get the difference between two timestamp ,when running this query in SPUFI
Code: |
SELECT
TIMESTAMP('2010-12-20-02.33.05.690798') -
TIMESTAMP('2010-12-20-01.33.05.690798' )
FROM SYSIBM.SYSDUMMY1;
|
resulted in :10000.000000
But the same when tried to put in my code as
Code: |
EXEC SQL
SET :A = TIMESTAMP('2010-12-20-02.33.05.690798') -
TIMESTAMP('2010-12-20-01.33.05.690798' )
END-EXEC.
|
is resulting in an error saying UNDEFINED OR UNUSABLE HOST VARIABLE A.
A is declared as PIC9(04)V9(06) COMP-3.
As this has to go in the table to a field of DECIMAL(10,6) i declared A in the above format.
Is the above correct??? please help me in this regards.[/quote] |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Why don't you check the manual?:
DB2 Vsn 8 SQL Reference wrote: |
Subtracting timestamps: The result of subtracting one timestamp (TS2) from
another (TS1) is a timestamp duration that specifies the number of years, months,
days, hours, minutes, seconds, and microseconds between the two timestamps. The
data type of the result is DECIMAL(20,6). |
further information can be obtained in the Application Programmers manual. |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
Back to top |
|
|
|