Home:ALL Converter>Oracle Format non date To Date in oracle

Oracle Format non date To Date in oracle

Ask Time:2014-12-10T11:29:00         Author:Khairu Aqsara

Json Formatter

Ho do we convert string with not date format to date format in oracle, i have date like this in my table

04082014

and i wanna make these string into date format like

2014-08-04 or with format yyyy-mm-dd

how do we do that in oracle ? if using the built in function in oracle like

TO_DATE('20020315', 'yyyy-mm-dd') or TO_DATE('20020315', 'yyyy/mm/dd')

can we use that format for between querys ? and what about peformance with huge data when we use that fungction ?

i just wanna know the peformance if using that function in huge data, and why when i using between function like

select * from PAID WHERE PDATE BETWEEN TO_DATE('04082014','DDMMYYYY') AND TO_DATE('05082014','DDMMYYYY')

and the result is

[Err] ORA-01861: literal does not match format string

Author:Khairu Aqsara,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/27392867/oracle-format-non-date-to-date-in-oracle
Gordon Linoff :

You would use the appropriate format for TO_DATE():\n\nTO_DATE('04082014', 'DDMMYYYY')\n\n\n(Assuming the date is 2014-08-04.)\n\nOracle stores dates in an internal format. If you want them in a particular format for output purposes, to TO_CHAR(), not TO_DATE().",
2014-12-10T03:34:19
yy