Re: How to test/read a stored procedure that returns a boolean? - Mailing list pgsql-sql

From Tom Lane
Subject Re: How to test/read a stored procedure that returns a boolean?
Date
Msg-id 29647.1200526120@sss.pgh.pa.us
Whole thread Raw
In response to How to test/read a stored procedure that returns a boolean?  (Kevin Jenkins <gameprogrammer@rakkar.org>)
Responses Re: How to test/read a stored procedure that returns a boolean?  (Kevin Jenkins <gameprogrammer@rakkar.org>)
List pgsql-sql
Kevin Jenkins <gameprogrammer@rakkar.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


pgsql-sql by date:

Previous
From: Kevin Jenkins
Date:
Subject: How to test/read a stored procedure that returns a boolean?
Next
From: Kevin Jenkins
Date:
Subject: Re: How to test/read a stored procedure that returns a boolean?