Re: How to test/read a stored procedure that returns a boolean?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kevin Jenkins <gameprogrammer(at)rakkar(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to test/read a stored procedure that returns a boolean?
Date: 2008-01-16 23:28:40
Message-ID: 29647.1200526120@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kevin Jenkins <gameprogrammer(at)rakkar(dot)org> writes:
> create or replace function IsUsedHandle(h text) returns boolean as $$
> declare
> begin
> select COUNT(*) as num_matches from handles where handles.handle = h;
> return num_matches > 0;
> end;
> $$ LANGUAGE plpgsql;

I think you've confused AS with INTO.

You forgot to declare num_matches as a local variable, too.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kevin Jenkins 2008-01-16 23:50:41 Re: How to test/read a stored procedure that returns a boolean?
Previous Message Kevin Jenkins 2008-01-16 23:15:41 How to test/read a stored procedure that returns a boolean?