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 ?
07-12-2001, 06:53 AM
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
07-12-2001, 07:40 AM
These both outputted the same result.
Can you Please explain the difference between RRRR and YYYY
07-12-2001, 09:40 AM
Hi, you must try this
07-12-2001, 06:45 PM
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
07-12-2001, 09:52 PM
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.