[firebase-br] Select em Procedure

Infosag infosag em terra.com.br
Qui Ago 27 11:59:52 -03 2009


cara experimenta trocar a variavel  vl_total decimal(15,2)  por vl_total 
numeric(15,2)

abs

----- Original Message ----- 
From: "Sérgio Alexandre Gianezini" <sergio_ag em terra.com.br>
To: <lista em firebase.com.br>
Sent: Wednesday, August 26, 2009 7:20 PM
Subject: Re: [firebase-br] Select em Procedure


> "for execute statement", fazendo isso, é praticamente as mesma coisa que 
> por um query no programa e mandar rodar, devia é por o select literalmente 
> (o que deixa pre-compilado e preparado).
> Quanto ao overflow, algum campo do select está maior que a variavel que 
> está recebendo... pode forçar o sum usando cast() e ver o que retorna...
>
> "Edison - Precisa Informatica Ltda" <edison em precisa.inf.br> escreveu na 
> mensagem news:4B2FA96FE34C4D65BEA02AE52A11CD97 em Saulibueno...
>
> Ola pessoal
>
> Estou construindo uma procedure que retorna o codigo do cliente e o valor 
> gasto na empresa
> - na Tabela de movimento o codigo do cliente e integer, e o valor gasto e 
> decimal(15,2)
>
> eu nao consigo retornar na procedure a soma do valor gasto ( utilizando o 
> sum )
>
> se eu retornar o valor sem o sum da certo,
> e somando a coluna, o fb retorna o seguinte erro Arithmetic overflown
>
> Arithmetic overflow or division by zero has occurred.
> arithmetic exception, numeric overflow, or string truncation.
>
> fonte do procedure
>
>
> CREATE PROCEDURE SOL_SECA001 (
>    i_chavereg integer,
>    s_empresa varchar(300),
>    d_dataini date,
>    d_datafin date)
> returns (
>    id_chavereg integer,
>    id_secao smallint,
>    id_grupo smallint,
>    id_subgrupo smallint,
>    id_cliente integer,
>    de_razao varchar(40),
>    vl_total decimal(15,2))
> as
> declare variable ssql varchar(700);
> BEGIN
>   sSql =  '  SELECT TBLCDSITE0.IDCHAVEREG, ' ;
>   sSql = sSql || '  TBLCDSITE0.IDSECAO, ';
>   sSql = sSql || '  TBLCDSITE0.IDGRUPO, ';
>   sSql = sSql || '  TBLCDSITE0.idsubgrupo, ';
>   sSql = sSql || '  TBLMVMITE0.idCliente, ';
>   sSql = sSql || '  TBLCDSCLI0.RAZAO,  ';
>   sSql = sSql || '  TBLMVMITE0.VLRTOTAL  ';
>   sSql = sSql || '  FROM TBLMVMITE0 LEFT JOIN TBLCDSITE0 ON 
> TBLMVMITE0.IDITEM = TBLCDSITE0.IDITEM            ' ;
>   sSql = sSql || '                  LEFT JOIN TBLCDSCLI0 ON 
> TBLMVMITE0.IDCLIENTE = TBLCDSCLI0.IDCLIENTE      ' ;
>   sSql = sSql || '  WHERE TBLMVMITE0.IDEMPRESA IN ( ' || :s_empresa || ')' 
> ;
>   sSql = sSql || '       AND   TBLMVMITE0.dtvalida BETWEEN ' || '''' || 
> :d_DataIni || '''' || ' and '          ;
>   sSql = sSql || '''' || :d_DataFin || '''' ;
>   sSql = sSql || '       and TBLMVMITE0.natureza = ' || '''' || 'S' || 
> '''' ;
>   sSql = sSql || '       and TBLCDSITE0.idchavereg = ' || :i_ChaveReg ;
>
>   sSql = sSql || ' ORDER BY TBLCDSITE0.IDSECAO,         ' ;
>   sSql = sSql || '     TBLCDSITE0.IDGRUPO,              ' ;
>   sSql = sSql || '     TBLCDSITE0.IDSUBGRUPO           ' ;
>
>
>   for execute statement
>      sSql
>      Into :id_ChaveReg, :id_Secao, :id_Grupo, :id_SubGrupo, :id_Cliente, 
> :de_Razao, :vl_Total
>   do
>      suspend;
> end^
>
>
>
> Atenciosamente
>
>
> Edison Savaris
> Desenvolvedor
> edison em precisa.inf.br
> ______________________________________________
> FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br
> Para saber como gerenciar/excluir seu cadastro na lista, use: 
> http://www.firebase.com.br/fb/artigo.php?id=1107
> Para consultar mensagens antigas: http://firebase.com.br/pesquisa
>
>
>
>
>
> E-mail verificado pelo Terra Anti-Spam.
> Para classificar esta mensagem como spam ou não spam, visite
> http://ecp.terra.com.br/cgi-bin/reportspam.cgi?+_d=SCY0MDQ0OTY1MCNwZXJtIXRlcnJhJjEsMTI1MTMyNTQ0Ni40MDk2NDIuMTI2NDcuY2FtZW5hbmEuaHN0LnRlcnJhLmNvbS5iciw3MTQ3TerraMail
> Verifique periodicamente a pasta Spam para garantir que apenas mensagens
> indesejadas sejam classificadas como Spam.
>


--------------------------------------------------------------------------------


______________________________________________
FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br
Para saber como gerenciar/excluir seu cadastro na lista, use: 
http://www.firebase.com.br/fb/artigo.php?id=1107
Para consultar mensagens antigas: http://firebase.com.br/pesquisa 





Mais detalhes sobre a lista de discussão lista