Re: WHAT'S WRONG WITH THIS

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 05 Sep 2000 19:57:33 +0800
Message-ID: <39B4DFAD.78E0_at_yahoo.com>


Sandy wrote:
>
> hi,
>
> I gave you a wrong code :
>
> function est_expediteur ( CodUtil in varchar2)
>
> return number is
> res number;
> begin
> select count(numexpvisu) into res from chargeurvisu where
> numexpvisu=CodUtil;
> return res;
> exception
> when others then
> return 0;
> end;
>
> I would like to kno if there 's another way to know if an
> element exists in a table . the function should return 0 if
> it doesn't exist and 1 if it does.
>
> 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

function est_expediteur ( CodUtil in varchar2) return number is
  res number;
begin
  select 1
  into res
  from chargeurvisu
  where numexpvisu=CodUtil
  and rownum < 2;
  return 1;
exception when no_data_found then
  return 0;
end;

HTH

-- 
===========================================
Connor McDonald
http://www.oracledba.co.uk

We are born naked, wet and hungry...then things get worse
Received on Tue Sep 05 2000 - 13:57:33 CEST

Original text of this message