Hi,
I want to convert the following Oracle query in to a DB2 query.
select *
FROM Vacation vac, BusinessEmployee emp
where
to_date(to_char(vac.startdate, 'MM/DD/YYYY'), 'MM/DD/YYYY') >= SUBSTR(SYSDATE, 1, 10)
The above query is to select all those rows that have the date value higher than the current date.
This is part of a complex query and is executing well i Oracle.
In DB2 i tried,
SELECT
TIMESTAMP(SUBSTR(CHAR(CHAR(DATE(vac.startdate), USA)), 7,4) || '-' || SUBSTR(CHAR(CHAR(DATE(vac.startdate), USA)), 1,2) || '-' || SUBSTR(CHAR(CHAR(DATE(vac.startdate), USA)), 4,2) || ' 00:00:00') >=
SUBSTR(CURRENT TIMESTAMP, 1, 10)
FROM Vacation vac, BusinessEmployee emp
i got the error,
[IBM][CLI Driver][DB2/LINUX] SQL0180N The syntax of the string representation of a datetime value is incorrect. SQLSTATE=22007
The left & right side of the comparison is working well when executed individually. The issue is in the comparison of them( a>= b)
Also tell me whether Oracle is doing any implicit datatype conversion to compare the different datatypes here?.
-gopidba