At first you do not need to convert datetime into string. Databases very well compares datetime values. Converting to text will make your query slower and it is not clear if it will be able to use indexes.
In Informix datetime (I used type datetime year to second
) can be as string literals.
In Informix there is no ISNULL()
function, but they have NVL()
function.
So I would write WHERE
condition as:
WHERE timestamp1 > NVL(timestamp2, '1900-11-11 00:00:00');