From: | "Juan Carlos Badillo Goy" <badillo(at)cav(dot)desoft(dot)cu> |
---|---|
To: | <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Necesito ayuda con una funcion |
Date: | 2005-07-22 19:31:29 |
Message-ID: | 002a01c58ef4$35921e20$4f01c0c0@cav.desoft.cu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Saludos a todos:
Tengo una funcion a la cual le paso parametros de tipo timestamp y no
funciona correctamente que puede estar ocurriendo.
CREATE OR REPLACE FUNCTION "public"."buscar_mensajes" (operador_logico
varchar, de varchar, fecha_envio_inic timestamp, fecha_envio_final
timestamp) RETURNS SETOF "public"."vista_bandeja_entrada" AS
$body$
declare v_rs_email vista_bandeja_entrada%rowtype;
declare s varchar;
declare b_where integer;
begin
s = 'select * from vista_bandeja_entrada';
b_where = 1;
if (not nullvalue(De)) and (not De = '') then
if b_where = 1 then
s = s||' where';
b_where = 0;
else
if (not nullvalue(operador_logico)) and (not operador_logico = '')
then
s = s||' '||operador_logico;
end if;
end if;
s = s||' '||'lower("De") like lower((''%'||De||'%''))';
end if;
if (nullvalue(Fecha_envio_inic)) and (not nullvalue(Fecha_envio_final))
then
if b_where = 1 then
s = s||' where';
b_where = 0;
else
if (not nullvalue(operador_logico)) and (not operador_logico = '')
then
s = s||' '||operador_logico;
end if;
end if;
s = s||' "Fecha_de_envio" <='||Fecha_envio_final;
end if;
for v_rs_email in
execute s
loop
return next v_rs_email;
end loop;
return;
end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;
Esta funcion no me retorna ningun record y existen en la base de datos
varios que cumplen la condic'on... le quito la condicion de la fecha y
funcionan corrcetamente..
De esta forma es como queda cuando rrecorro la funcion.
select * from vista_bandeja_entrada where lower("De") like
lower(('%cfelipe%')) and "Fecha_de_envio" <=2005-07-20
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Andrade Fonseca | 2005-07-22 19:32:59 | Re: Problemas con las comparaciones de fechas |
Previous Message | Martín Marqués | 2005-07-22 19:11:00 | Re: transportar base de datos |