Isn't this one more simple:
Code:
create or replace function check_dateformat(p_date_input varchar2)
return boolean is
lv_date_return DATE ;
return_value BOOLEAN := TRUE;
BEGIN
BEGIN
lv_date_return := TO_DATE (p_date_input, 'DD-MM-YYYY');
IF lv_date_return NOT BETWEEN TO_DATE ('01-01-1900', 'DD-MM-YYYY') AND TO_DATE ('01-01-1900', 'DD-MM-YYYY') THEN
return_value := FALSE;
END IF;
EXCEPTION
WHEN OTHERS THEN return_value := FALSE;
END;
RETURN return_value;
END;
Why even bother with checking months and day of months, with leap years and so on - it is all implicitly checked in a TO_DATE function.
I only left the year range checking if you realy need to check this, otherwise you should simply throw that part out.
Jurij Modic
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?