Re: date input

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: 2000/08/11
Message-ID: <966016226.10684.1.pluto.d4ee154e_at_news.demon.nl>#1/1


No not really. I would use
select to_date(... etc
into varconv
[Quoted] from dual;

probably, but essentially that's the same.

Try removing the exception section and see what happens.

Hth,

Sybrand Bakker, Oracle DBA

"Sandy" <daleelaNOdaSPAM_at_usa.net.invalid> wrote in message news:002d4c9c.24dc699f_at_usw-ex0109-068.remarq.com...
> hi,
>
> I wanted to check if a date is like this DD/MM/YYYY.
> I have made a function :
>
> function Heure_valide2
> (heure VARCHAR2)
> return BOOLEAN is
> Nb1 NUMBER;
> Nb2 NUMBER;
> Nb3 NUMBER;
>
> begin
> Nb1:=TO_NUMBER(SUBSTR(heure,1,2));
> Nb2:=TO_NUMBER(SUBSTR(heure,4,2));
> Nb3:=TO_NUMBER(SUBSTR(heure,7,2));
>
> if heure is null then return(true);
> end if;
> if (LENGTH(heure) !=8 ) then
> return (false);
> elsif not ( INSTR(heure,':',1,1)=3 or INSTR(heure,':',1,2)
> =6 ) then
> return (false);
> elsif not ( Nb1 <=0 or Nb1 <=23) then
> return (false);
> elsif not ( Nb2 <=0 or Nb2 <=59) then
> return (false);
> elsif not ( Nb3 <=0 or Nb3 <=59) then
> return (false);
> end if;
>
> return (true);
>
> return (false);
> exception
> when others then
> return(false);
> end;
>
> ----
>
> i tried one someone gave me :
>
> heure_valide
> (heure in varchar2) return integer is
> varconv date;
> begin
> varconv := to_date (heure, 'HH24:MI:SS');
> return 1;
> exception
> when others then
> return 0;
> end;
>
>
> this one used used to work but doesn't work anymore dunno
> why . IS there anything wrong in it ??
>
> 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 Received on Fri Aug 11 2000 - 00:00:00 CEST

Original text of this message