Wednesday, April 24, 2019

Oracle: using DATE type in the WHERE clause condition

If the WHERE clause contains a condition of DATE type, we can use TO_DATE() to convert a date string into DATE type. For example:

SELECT * FROM MyTable WHERE DateField > TO_DATE('2019-04-23 21:30:00', 'YYYY-MM-DD HH24:MI:SS');

The second parameter of TO_DATE() method is the format model. To find out the complete list of datetime format elements, follow this link:

No comments:

Get This <