2008/4/3, Claudio Rogerio Carvalho Filho <[EMAIL PROTECTED]>:
>
> 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;
PERFORM mesref FROM arqexa WHERE mesref = xmesref and controle = xcontrole
limit 1;
if (not found) then
> return false;
> else
> return true;
> end if;
return FOUND;
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
>
>
--
William Leite Araújo
Analista de Banco de Dados - QualiConsult
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral