Thursday, November 11, 2010

Oracle - Differnce between RRRR & YYYY

RR converts two-digit years into four-digit years by rounding, where as YY does consider the same.60-99 are stored as 1960-1999, it automatically rounds using the current century.

Example:

SELECT TO_DATE('12-MAR-86','DD-MON-YYYY') FROM DUAL
3/12/0086

SELECT TO_DATE('12-MAR-86','DD-MON-RRRR') FROM DUAL
3/12/1986
 
SELECT TO_DATE('12-MAR-86','DD-MON-YY') FROM DUAL
3/12/2086

SELECT TO_DATE('12-MAR-86','DD-MON-RR') FROM DUAL
3/12/1986


Note: The above code is been tested in TOAD - Oracle Version 9.0.1

No comments:

Post a Comment