Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: to_date
You can create a function, for instance:
v734> create or replace function check_date (in_date in varchar2)
2 return date is
3 my_date date;
4 begin
5 my_date := to_date (in_date, 'DD/MM/YYYY'); 6 return my_date; 7 exception 8 when others then 9 raise_application_error (-20000, 'Wrong date format');10 end;
Function created.
v734> select to_char(check_date('01/01/2000'),'DD-MON-YY') from dual;
TO_CHAR(CHECK_DATE('01/01/2000'),'DD-MON-YY')
v734> select to_char(check_date('32-JAN-0'),'DD-MON-YY') from dual; ERROR:
ORA-20000: Wrong date format ORA-06512: at "MMA$EP34087.CHECK_DATE", line 9 ORA-06512: at line 1
-- Have a nice day Michel Sandy <daleelaNOdaSPAM_at_usa.net.invalid> a écrit dans le message : 32bd4fa0.54ab8325_at_usw-ex0109-068.remarq.com...Received on Thu Jul 27 2000 - 00:00:00 CDT
> i want to check if a date is correct and i would like to
> know how to do : my date must be like this DD/MM/YYYY and
> whatever characters would be entered i would like to check
> if it is a date in the format DD/MM/YYYY.
>
> thanks
>
> sandy
>
>
> * Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images,
Audios, Videos, News, and Shopping. Smart is Beautiful
![]() |
![]() |