Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date Format Issue converting from DATE to NVARCHAR2

kumar73Dec 12 2012 — edited Dec 12 2012
Hello Friends,

Here's the issue i am facing with dates conversion ..

-- in source builddate format is DD-MM-YY and the data type is DATE
select builddate from abc where vehiclecode in (
'ZCBE53585',
'ZCBE53561',
'ZCBL53668',
'HGMX43520')

output :

21-05-12
21-05-12
24-05-12
22-10-44


in target builddate type is NVARCHAR2 and trying to convert into YYYY-MM-DD format [ to store abc.builddate into xyz.builddate ]

select TO_CHAR(TO_DATE(abc.builddate,'DD-MM-RR'),'YYYY-MM-DD') from xyz where vehiclecode in (
'ZCBE53585',
'ZCBE53561',
'ZCBL53668',
'HGMX43520')

output :

2012-05-21
2012-05-21
2012-05-24
2044-10-22



if you see the last output the date 22-10-44 should be 1944-10-22 which I want but the output shows as 2044-10-22 .

This has become the big issue ..

Please let me know how I can go about it ..

thanks/kumar

Edited by: kumar73 on 12 Dec, 2012 8:20 AM

Edited by: kumar73 on 12 Dec, 2012 8:21 AM
This post has been answered by John Spencer on Dec 12 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 9 2013
Added on Dec 12 2012
16 comments
988 views