Thanks Adam,
Using the Cast solved the problem.
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3
________________________________
From: Adam Glauser <adamglauser@xxxxxxxxxxxx>
To: midrange-l@xxxxxxxxxxxx
Sent: Tuesday, November 18, 2008 1:32:46 PM
Subject: Re: SQL TIMESTAMPDIFF
Jeff Young wrote:
The problem I am having is that the system is not finding the TIMESTAMPDIFF built in function in SQL.
I don't use straight SQL much (we have SEQUEL here), but I thought that
getting the parameters right might help. Some languages identify
functions by name _and_ parameter list in order to support overloading.
It seems I was both wrong and right. My first suggestion does not work
on my system with a "timestampdiff not found" error:
select
timestampdiff(2,timestamp('2008-10-10','10:10:10')-timestamp('2008-10-09','10:10:10'))
from sysibm.sysdummy1
This however does work:
select
timestampdiff(2,cast(timestamp('2008-10-10','10:10:10')-timestamp('2008-10-09','10:10:10')
as char(22)))
from sysibm.sysdummy1
The example in the documentation shows that the result of the timestamp
difference as to be cast to character for TIMESTAMPDIFF.
HTH,
Adam
As an Amazon Associate we earn from qualifying purchases.