case stement when null - Mailing list pgsql-sql

From Jaime Casanova
Subject case stement when null
Date
Msg-id BAY8-F104oxRI8gcXIi0003bc86@hotmail.com
Whole thread Raw
Responses Re: case stement when null  ("Riccardo G. Facchini" <abief_ag_-postgresql@yahoo.com>)
Re: case stement when null  ("V i s h a l Kashyap @ [Sai Hertz And Control Systems]" <sank89@sancharnet.in>)
List pgsql-sql
hi all,

Well i rethink my design 'cause the other was too slow. but all solutions 
involves new problems... now my problem is with a function of this type:


CREATE OR REPLACE FUNCTION "public"."rec_f_consultarplanificacionrubros" 
(smallint, smallint, char(9), smallint, smallint, smallint, char(2)) RETURNS 
SETOF "public"."rec_td_rubrosplanificados" AS '   select rub_codigo, cpa_valor, cpa_fechavencimiento        from
rec_m_cuadropagosciclo   where ent_codigo = $1      and sec_codigo = $2      and ani_codigo = $3      and case $4
          when null then cic_codigo IN (select cic_codigo from 
 
aca_m_cicloaniolectivo                                                       where ent_codigo = 
$1                                                         and sec_codigo = 
$2                                                         and ani_codigo = 
$3)                  else cic_codigo = $4             end
' LANGUAGE 'sql'

but when $4 is null the function executes the else part and what i want to 
do is to execute the when null. Can you help me???


Thanx in advance,

Jaime Casanova

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail



pgsql-sql by date:

Previous
From: "David B"
Date:
Subject: In 7.4 ensure you have DEFAULT now () with no spaces
Next
From: "Riccardo G. Facchini"
Date:
Subject: Re: plpgsql - Insert from a record variable?