Well when you use the to_date it shows the value as a 2 char date.
You will need to use to_char again to get it back to a 4 char date.
Maybe this will explain:
create table test (sample_date date);
insert into test values (sysdate);
select TO_DATE(TO_CHAR(SAMPLE_DATE,'DD-MON-YYYY'),'DD-MON-YYYY' ) from test;
TO_DATE(T
---------
28-MAR-01
select TO_CHAR(SAMPLE_DATE,'DD-MON-YYYY') from test;
TO_CHAR(SAM
-----------
28-MAR-2001
update test set sample_date=TO_DATE(TO_CHAR(sysdate,'DD-MON-YYYY'),'DD-MON-YYYY' );
commit;
select TO_CHAR(SAMPLE_DATE,'DD-MON-YYYY') from test;
TO_CHAR(SAM
-----------
28-MAR-2001
You really are doing nothing wrong oracle just shows the dates as 2 characters.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only