Quote:
|
Originally Posted by vivek.vivek
TO_DATE(Param3,'MM/DD/YYYY HH24:MI: SS')
|
This is essentially a datatype cast from a textual expression to a date/time field.
DB2 has the datatype TIMESTAMP for this purpose.
In DB2, casting from text to timestamp can be done through the standard CAST(... AS ...), provided the text is in the format yyyy-mm-dd-hh.mm.ss
So you'll first have to convert Param3 to a rearranged textual form before passing it to the CAST:
Code:
CAST( SUBSTR(P,7,4)||'-'||SUBSTR(P,1,2)||'-'||SUBSTR(P,4,2)||'-'
|| SUBSTR(P,12,2)||'.'||SUBSTR(P,15,2)||'.'||SUBSTR(P,18,2)
AS TIMESTAMP)
Plugging this in into your meta-query (after doubling the single quotes and replacing "P" by "'||Param3||'") should give what you want.
(See also page 84 of the DB2 for LUW v9.5 SQL Reference, Volume 1 for info about using the TIMESTAMP datatype.)