Re: PL/PGSQL question

Поиск
Список
Период
Сортировка
От Christoph Dalitz
Тема Re: PL/PGSQL question
Дата
Msg-id 20030117091344.50f698c4.christoph.dalitz@hs-niederrhein.de
обсуждение исходный текст
Ответ на PL/PGSQL question  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
> Date: Fri, 17 Jan 2003 15:09:32 +0900
> From: Jean-Christian Imbeault <jc@mega-bucks.co.jp>
>
> I wrote the following plpgsql function. The problem I have is that if no
> rows are found my function returns NULL whereas it should be returning 0.
>
>      IF NOT FOUND THEN
>        RETURN 0;
>      END IF;
>      RETURN total_sales;
>
I am not sure how close PL/pgSQL is to the "Persistent Stored Modules" (PSM)
of the SQL3 standard. If it is quite close it has inherited an insane feature
of PSM: "return" does *not* end the function, but only sets the return value.

Check whether the following code works:

      IF NOT FOUND THEN
        RETURN 0;
      ELSE
        RETURN total_sales;
      END IF;

Christoph Dalitz

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

Предыдущее
От: "Stefan Scherf"
Дата:
Сообщение: temporary tables on hd or in memory?
Следующее
От: "kanchana"
Дата:
Сообщение: Fw: configure error with krb5