IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

TIMESTAMPDIFF


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Deepatinfy

New User


Joined: 06 Jun 2005
Posts: 7

PostPosted: Fri Jul 08, 2005 4:54 pm
Reply with quote

Hi All,

Can you correct this query for me?

SELECT DF1,TIMESTAMPDIFF(16,DF1) AS DIFF, DAYS('1996-03-01-00.00.01') - DAYS('1995-03-01-00.00.00') AS DAYS
FROM (
SELECT TS1,TS2,CHAR(TS1 - TS2) AS DF1
FROM (
SELECT TIMESTAMP('1996-03-01-00.00.01') AS TS1, TIMESTAMP('1995-03-01-00.00.00') AS TS2
FROM SYSIBM.SYSDUMMY1
)AS TEMP2
)AS TEMP3

The error that shows up is,

QUERY MESSAGES:
NO FUNCTION BY THE NAME TIMESTAMPDIFF HAVING COMPATIBLE ARGUMENTS WAS FOUND

Thanks,
Deepesh
Back to top
View user's profile Send private message
somasundaran_k

Active User


Joined: 03 Jun 2003
Posts: 134

PostPosted: Fri Jul 08, 2005 8:07 pm
Reply with quote

Deepatinfy

TIMESTAMPDIFF is used to find out the difference between two timestamps.But in your query you have specified only one timestamp. It should be something like TIMESTAMPDIFF(16,(DF1-DF2)) where DF1 and DF2 are the two timestamps that you want find out the difference in days.

hth
-Som
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Search our Forums:

Back to Top