From: | Hellmuth Vargas <hivs77(at)gmail(dot)com> |
---|---|
To: | Felipe Araoz Ramos <faraoz(at)gmail(dot)com>, Lista Postgres ES <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: Select anidado dentro de Case when |
Date: | 2014-09-21 15:33:40 |
Message-ID: | CAN3Qy4r9yzkm=A2ty9SeNBMu0QDmBNp2N65nL_ucWyaV_+sTVQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Hola lista
SELECT c1,c2 FROM tabla WHERE c1='ME' AND CASE WHEN $1='1' THEN c2='2013'
ELSE TRUE END;
El 21/09/2014 09:30, "Felipe Araoz Ramos" <faraoz(at)gmail(dot)com> escribió:
> Buen dias amigos del foro
>
> Estoy queriendo hacer mas flexible mi función y quiero hacer algo como
> esto; anidar select dentro de un bloque case,... es posible hacer esto
>
> begin
> return query
> case when $1='1' then
> select c1,c2 from tabla where c1='ME' and c2='2013'
> else
> select c1,c2 from tabla where c1='ME'
> end;
> end;
> $BODY$
> LANGUAGE plpgsql VOLATILE
> COST 100
> ROWS 1000;
>
> Gracias de antemano
>
> *Felipe Araoz Ramos*
> RPM #941990605 / 941990605
> RPC 992760385
> NXT 822*9500 / 998229500
>
From | Date | Subject | |
---|---|---|---|
Next Message | Guillermo E. Villanueva | 2014-09-22 01:46:49 | Re: Select anidado dentro de Case when |
Previous Message | felix gonzales | 2014-09-21 14:50:35 | Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] webinar sobre Replicación Bi Direccional (BDR) en PostgreSQL |