Message: 1
Date: Thu, 3 Apr 2008 08:29:46 -0300
From: " William Leite Araújo "  <[EMAIL PROTECTED]>
Subject: Re: [pgbr-geral] LENTIDÃO EM STORED PROCEDURE
To: "Comunidade PostgreSQL Brasileira"
       <[email protected]>
Message-ID:
       <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="utf-8"

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
-------------- Pr?a Parte ----------
Um anexo em HTML foi limpo...
URL:
http://listas.postgresql.org.br/pipermail/pgbr-geral/attachments/20080403/e7bd3987/attachment.html

------------------------------
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a