Re: Function's final statement must be a SELECT

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Function's final statement must be a SELECT
Дата
Msg-id 20080514203621.GI9838@alvh.no-ip.org
обсуждение исходный текст
Ответ на Function's final statement must be a SELECT  ("Premil Agarwal" <preagarw@gmail.com>)
Ответы Re: Function's final statement must be a SELECT
Список pgsql-admin
Premil Agarwal escribió:
> I am trying to write a function in PgAdmin 1.8.2 for postgres 8.3. The
> function should check the input parameter for NULL. If its NULL then
> function should return 'Auto' otherwise return the input as such.

>
> CREATE FUNCTION check_for_null( inp character varying) RETURNS character
> varying AS $$
[...]
> $$ LANGUAGE SQL;

              ^^^

There's your problem.  Try using PLPGSQL instead.

In any case, you can do this with COALESCE() and it's much easier.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: [INTERFACES] Function's final statement must be a SELECT
Следующее
От: "Premil Agarwal"
Дата:
Сообщение: Re: [INTERFACES] Function's final statement must be a SELECT