Friday, August 27, 2010

Oracle Dates and Timestamps

Date/Timestamps in Oracle make be break out into hives. And then I start to miss MS SQL Server.....a little.

Oracle does not like to return timestamps when querying date/time fields; so sometimes I have to use something like this:

SELECT to_char(to_timestamp(to_char(a.fieldName, 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS'))
FROM tableName a