From: | Felipe Araoz Ramos <faraoz(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-foro <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Funcion con parametros |
Date: | 2016-10-31 00:20:20 |
Message-ID: | CAM6fARx=QCYybrw6A9pgf+Z81y1H3HTgRMOxVz9hBFwMDcpTNA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Buena noche amigos
He hecho una funcion simple que me lista una tabla filtrando por un campo,
sin embargo cuando ejecuto la funion sin paramtros tambien me la muestra,
deberia ser asi?
CREATE OR REPLACE FUNCTION ufp_lista_ccosto (IN character)
RETURNS TABLE(t_elem character varying, t_des1 character varying, t_area
character varying) AS
$BODY$
declare
x_empr alias for $1;
begin
return query
SELECT ccosto.t_elem,ccosto.t_des1,ccosto.t_area
FROM fpcost ccosto
where ccosto.t_empr=x_empr
ORDER BY ccosto.t_elem;
end;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
ROWS 1000;
cuando ejecuto
SELECT * from ufp_lista_ccosto('01') me mestra filtrando
SELECT * from ufp_lista_ccosto(), me mestra todo
*Felipe Araoz Ramos*
RPM #941990605 / 941990605
*Lima-Perù *
From | Date | Subject | |
---|---|---|---|
Next Message | Carlos Enrique Perez | 2016-10-31 00:40:06 | Re: Funcion con parametros |
Previous Message | Jaime Casanova | 2016-10-30 15:14:20 | Re: Cambio en tipo de columna de varchar por text |