Another plpgsql question..

Поиск
Список
Период
Сортировка
Искать
От
Mitch Vincent
Тема
Another plpgsql question..
Дата
Msg-id
008c01c08550$52c2cd30$0200000a@windows
Список
Дерево обсуждения
Re: Another plpgsql question.. "Mitch Vincent" <mitch@venux.net>
Re: Another plpgsql question.. Tom Lane <tgl@sss.pgh.pa.us>
CREATE FUNCTION invoice_payment() RETURNS OPAQUE AS '
BEGIN

   UPDATE invoice_master SET total = total - NEW.amount,updated = now(),
is_paid=(CASE WHEN (total - NEW.amount) = 0.00 THEN ''t'' ELSE ''f'' END)
WHERE invoice_id = NEW.invoice_id;

   RETURN NEW;

END;
' LANGUAGE 'plpgsql';

Ok, thanks for the heads up on now().. That works but I add the last part of
the query in there and everything but the last part works.. Can I not do
CASE WHEN statements in functions like that? That query works when I run it
straight from psql but so did the other, so I'm wondering if the same kind
of problem is happening here too..

Thanks!

-Mitch

В списке pgsql-general по дате отправления
От: Alexander Jerusalem
Дата:
Сообщение: Re: postgres memory management
От: Frank Joerdens
Дата:
FAQ