Oracel Date function
When it comes to handling date and time, Oracle PL/SQL is not as easy or convenient as Microsoft SQL. For instance, with MS SQL, you can write a query like:
SELECT * FROM SomeTable WHERE DateAdded = ‘09-29-2006 08:00:00 AM’
But with PL/SQL, the above query will not run and will generate an error message like ‘not a valid month’. To make it work, you have to use “To_Date” function to convert the DateTime string to a DateTime value:
SELECT * FROM SomeTable WHERE DateAdded = to_date(‘09-29-2006 08:00:00 AM’, ‘mm-dd-yyyy HH:MI:SS AM’)
- Comments Off