Re: varchar to date

From: (wrong string) ío <jgonzalezsuareNO_at_SPAMnexo.es>
Date: Fri, 30 Nov 2001 13:27:39 +0100
Message-ID: <llnc0ucav6sct06j6s2a0lbvgi8gq0mf1u_at_4ax.com>


I suppose your data are wrong. They don't fix the DD.MM.YYYY mask. Try to find which rows are wrong with a query like this:

Select end_date from your_table
where To_number(substr(end_date, 1, 2)) > 31 or To_number(substr(end_date, 4, 2)) > 12;

This will find BIG errors in your end_date column that you'll can fix. After this, if you still get the error, you'll have to be more accurate and look for wrong dates like 31.11 and so on.

Another helpful query could be something like this:

Select min(substr(end_date, 1, 2)), max(substr(end_date, 1, 2)), 
min(substr(end_date, 4, 2)), max(substr(end_date, 4, 2)), 
min(substr(end_date, -4)), max(substr(end_date, -4)), 
min(length(end_date)), max(length(end_date))
from your_table;
--
Julio César Glez Suarez
Xixón, Asturies, Spain
jgonzalezsuareNO_at_SPAMnexo.es (Remove NO SPAM)
Received on Fri Nov 30 2001 - 13:27:39 CET

Original text of this message