Re: count row function
Date: Tue, 5 Sep 2000 08:59:00 +0100
Message-ID: <NI1t5.21059$r4.11116_at_news.indigo.ie>
[Quoted] Hi Sandy,
select count(*) from a table will always return 1 row regardless of the [Quoted] where clause, so in the case of the situation below the query will return
Count(*)
0
what you can do instead is
select count(*) into variable from client where clientno='02' and then have
[Quoted] PLSQL look at the value of the variable so tour function will look something
[Quoted] like this
create or replace function clientidexists(clientid in varchar2 default '00')
return boolean
is
myrowcount number(10);
begin
[Quoted] select count(*) into myrowcount from client where clientno=clientid; if myrowcount = 0 then
return 'false';
else return 'true';
end if;
end ;
hth
Sandy wrote in message <1659ac50.4d8c8fed_at_usw-ex0110-076.remarq.com>...
>hi,
>
>I want to know if a client exists in a function. For this I
>have made a function with a select count... that returns
>the number of rows of the query : if he exists 1( normally)
>and if not 0. But doesn't work correctly. What happens
>when for example a client number '02' doesn't exist in the
>table client and we do the query :
>
>select count(*) from client where client.number='02';
>
>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 Tue Sep 05 2000 - 09:59:00 CEST