Re: Another plpgsql question..

From: "Mitch Vincent" <mitch(at)venux(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Another plpgsql question..
Date: 2001-01-23 16:02:28
Message-ID: 00d901c08555$e2c57680$0200000a@windows
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

is_paid is never updated...

-Mitch

----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mitch Vincent" <mitch(at)venux(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Tuesday, January 23, 2001 10:56 AM
Subject: Re: [GENERAL] Another plpgsql question..

> "Mitch Vincent" <mitch(at)venux(dot)net> writes:
> > 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..
>
> It looks fine to me. Please define "everything but the last part works"
> more precisely.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-01-23 16:05:41 Re: Another plpgsql question..
Previous Message Tom Lane 2001-01-23 15:56:54 Re: Another plpgsql question..