Estou com problema nessa consulta. Já sei que o erro é na linha em negrito,
a rotina esta MUITO LENTA. Observem que eu não sei como fazer um sql dentro
de uma função, dai me utilizei de um FOR.
ALGUEM PODERIA ME AJUDAR A FAZER ESTA ROTINA FICAR MAIS RAPIDA?
CREATE OR REPLACE FUNCTION func_tem_atos_digitados(xmesref bpchar, xcontrole
integer)
RETURNS boolean AS
$BODY$
declare
tbARQEXA RECORD;
begin
FOR tbARQEXA IN select * from arqexa where mesref = xmesref and controle =
xcontrole limit 1 LOOP END LOOP;
if (not found) then
return false;
else
return true;
end if;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION func_tem_atos_digitados(xmesref bpchar, xcontrole integer)
OWNER TO postgres;
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral