开发者

Oracle TO_DATE not working

开发者 https://www.devze.com 2023-02-28 00:39 出处:网络
I have this query which is not returning any rows. But t开发者_如何学编程here are records which are greater than 25-JUN-90 date. Why is it not working?

I have this query which is not returning any rows. But t开发者_如何学编程here are records which are greater than 25-JUN-90 date. Why is it not working?

{SELECT employee_id, last_name,hire_date
   FROM employees WHERE hire_date > TO_DATE('25-JUN-90','dd-mon-yy');}


You want to use the RR date format mask to change 90 to 1990:

SELECT employee_id, last_name,hire_date
FROM employees WHERE hire_date > TO_DATE('25-JUN-90','dd-mon-RR');


Which century does it translate '90' to? 1990 or 2090?

See Oracle Dates and Times for one description of Oracle date format characters. As Jeffrey Kemp's answer suggests, for the time being (the next 30 years or so), you can get '1990' from '90' using the format letters 'RR'. However, it would be better to use 4-digit years; the lessons of Y2K have been forgotten already, it seems.

0

精彩评论

暂无评论...
验证码 换一张
取 消