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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to test/read a stored procedure that returns a boolean?
Дата
Msg-id 29647.1200526120@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How to test/read a stored procedure that returns a boolean?  (Kevin Jenkins <gameprogrammer@rakkar.org>)
Ответы Re: How to test/read a stored procedure that returns a boolean?  (Kevin Jenkins <gameprogrammer@rakkar.org>)
Список 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 по дате отправления:

Предыдущее
От: Kevin Jenkins
Дата:
Сообщение: How to test/read a stored procedure that returns a boolean?
Следующее
От: Kevin Jenkins
Дата:
Сообщение: Re: How to test/read a stored procedure that returns a boolean?