Simple Oracle SQL date syntax question Simple Oracle SQL date syntax question oracle oracle

Simple Oracle SQL date syntax question


In Oracle, your date should be written as an ANSI date literal like this:

DATE '2008-11-11'

Or converted to a date from a string like this:

TO_DATE('11/11/2008', 'MM/DD/YYYY')

See here


Don't assume the default Oracle date format is anything. Check the NLS_DATE_FORMAT or use TO_DATE to convert it. Like this:

TO_DATE('2008-11-18 14:13:59', 'YYYY-MM-DD HH24:Mi:SS')

Note the 'Mi' for the minutes and not 'MM'. That catches a lot of people.


according to this you can use the following:

to_date('19960725','YYYYMMDD')