![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
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. |
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
--- Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> escribió: 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. I will try but this work in v7.4.2 that's why i think is an error. |
#4
| |||
| |||
|
|
Jaime Casanova <systemguards (AT) yahoo (DOT) com> writes: --- Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> escribió: 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. I will try but this work in v7.4.2 that's why i think is an error. It most certainly did not work in 7.4.2, or any other PG release. plpgsql doesn't have a CASE statement. regards, tom lane |
#5
| |||
| |||
|
|
--- Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> escribió: It most certainly did not work in 7.4.2, or any other PG release. plpgsql doesn't have a CASE statement. This is a production server... and the same script... (It was an error in v7.4.2 to permit this?) |
#6
| |||
| |||
|
|
Jaime Casanova <systemguards (AT) yahoo (DOT) com> writes: --- Tom Lane <tgl (AT) sss (DOT) pgh.pa.us> escribió: It most certainly did not work in 7.4.2, or any other PG release. plpgsql doesn't have a CASE statement. This is a production server... and the same script... (It was an error in v7.4.2 to permit this?) Are you sure the function has ever been executed? 7.4 gives me regression=# select recaudaciones.rec_f_aperturarcaja(1::int2,2::int2) ; ERROR: syntax error at or near "ELSE" CONTEXT: compile of PL/pgSQL function "rec_f_aperturarcaja" near line 51 8.0 is just reporting the error when the function is defined instead of at first call. |
![]() |
| Thread Tools | |
| Display Modes | |
| |