Page 1 of 1

File input "1-Apr-97" how to convert in date

Posted: Tue Oct 30, 2007 12:05 am
by Mhasan
Iam readign CSV file using squential stage , input data from that it coming like 1-Apr-95 , 1-sep-00 how to Load that into Oracle DB
I have tried stringtodate(input,"%dd-%mmm-%yy") But it is working only for data like
27-sep-95 not for 1-Apr-07 , how to overcome this Issue.

Thanks
Hasan

Posted: Tue Oct 30, 2007 12:22 am
by Maveric
Try If Len(input) = 8 then stringtodate("0" : input,"%dd-%mmm-%yy") Else stringtodate(input,"%dd-%mmm-%yy").
What it does is check if the length of the string is 8 i.e "1-Apr-07" then it will append the input with a leading zero and then convert it to date.

Posted: Tue Oct 30, 2007 12:35 am
by ArndW
And add 2 more ELSE clauses for double-digit days then you are ready.