Dear SQL Guru from:
Environment: Oracle
I am trying to understand why I cannot make a choice to_date in a table column that contains rows. Z notes table with a name column The value in the example below contains a bunch of rows, some of which are in the correct format, for example, 6/20/2010 00:00:00.
tableZ
| Value | | __________________ | | 6/21/2010 00:00:00 | | Somestring | | Some Other strings | | 6/21/2010 00:00:00 | | 6/22/2010 00:00:00 |
Next works
SELECT To_Date(c.Value, 'MM/DD/YYYY HH24:MI:SS') somedate FROM tableX a, tableY b, tableZ c WHERE Lower(a.name) = 'somedate' AND a.id = b.other_id AND b.id = c.new_id
This returns something like (which is good):
| somedate | | __________________ | | 21.06.2010 00:00:00 | | 21.06.2010 00:00:00 | | 22.06.2010 00:00:00 |
Does not work
SELECT To_Date(c.Value, 'MM/DD/YYYY HH24:MI:SS') somedate FROM properties$aud a, template_properties$aud b, consumable_properties$aud c WHERE Lower(a.name) = 'somedate' AND a.id = b.property_id AND b.id = c.template_property_id AND To_Date(c.Value, 'MM/DD/YYYY HH24:MI:SS') IS NOT NULL
Returns from:
ORA-01861: literal does not match format string
What am I missing here? Just fast:
... AND b.id = c.template_property_id AND To_Date(c.Value, 'DD.MM.YYYY HH24:MI:SS') IS NOT NULL
doesn't work either.
Thanks!!
The goal is to be able to set the date of BETWEEN requests to c.value to select date ranges.
source share