El 28 de noviembre de 2009 12:19, suso <jlcubas(at)terra(dot)es> escribió:
> Hola Juliom claro, precisamente por eso quiero saber si tiene ams de "X"
> cantidad o menos, pq si tengo muchos, en el offset voy asignando una
> fracción de esa cantidad, pero si asigno mas de los que tengo..cae y no
> funciona, no?
Prueba de nuevo esta función:
CREATE OR REPLACE FUNCTION cont_reg(apelli character varying)
RETURNS integer AS
$BODY$
DECLARE
devuel integer;
BEGIN
if apelli is not null THEN
select count(*) into devuel from pacientes where apell like
apelli||'%';
end if;
if found then
return devuel;
else
return 0;
end if;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;