I am trying to work out what the 'RR' Parameter in the to_data function represents. Can anyone please explain.
I entered the following in sqlplus :
and got the following error
ORA-01840: input value not long enough for date format
anybody know why?
What would be the correct syntax to display 'RR' as part of a date ?
What is it ?
Try either one of these:
select to_char(sysdate, 'DD-MON-RRRR') from dual;
select to_char(sysdate, 'DD-MON-YYYY') from dual;
to_char and not to_date
OCP DBA 8i, 9i, 10g
These both outputted the same result.
Can you Please explain the difference between RRRR and YYYY
Hi, you must try this
select to_char(to_date('27-OCT-98', 'DD-MON-RR'), 'YYYY') "Year"
Would return the previous century:
On the other hand:
select to_char(to_date('27-OCT-98', 'DD-MON-YY'), 'RRRR') "Year"
Would return current century
RR code is used to round the century based on the current year and 2 digit year.
If current year is >=50 and 2digit year is <50,it rounds to next century.
If current year is <50 and 2digit year is>50,it rounds to previous century.
If the current year is >=50 and 2digit year is >=50 the century remains unchanged.
If the current year is <50 and 2digit year is <50 the century remains unchanged.
Click Here to Expand Forum to Full Width