Re: a bug in plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jaime Casanova <systemguards(at)yahoo(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: a bug in plpgsql
Date: 2004-11-04 19:47:40
Message-ID: 28336.1099597660@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jaime Casanova <systemguards(at)yahoo(dot)com> writes:
> CASE rs_dtran.fpg_codigo
> WHEN ''EF'' THEN
> IF rs_ttran.tra_tipo = ''+'' THEN
> valor_ef := valor_ef + rs_dtran.dtr_valor;
> ELSE
> valor_ef := valor_ef - rs_dtran.dtr_valor;
> END IF;
> WHEN ''CH'' THEN
> IF rs_ttran.tra_tipo = ''+'' THEN
> valor_ch := valor_ch + rs_dtran.dtr_valor;
> ELSE
> valor_ch := valor_ch - rs_dtran.dtr_valor;
> END IF;
> END;

> but in that line there is a valid IF .. THEN .. ELSE
> block.

if/then/else is a statement, not a component of an expression.
CASE is an expression construct, not a statement. I think
you need to rewrite the CASE as an if/then/elsif statement.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jaime Casanova 2004-11-04 19:50:43 Re: a bug in plpgsql
Previous Message Jaime Casanova 2004-11-04 19:37:14 a bug in plpgsql