If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Calcule...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-10-08, 15:33
dicipulofer dicipulofer is offline
Registered User
 
Join Date: Oct 2007
Posts: 55
Calcule...

Hello..

How I do this calcule in sql...

valor / (1 + 0.098) ^ 10
Reply With Quote
  #2 (permalink)  
Old 09-11-08, 05:31
stanislav.ondac stanislav.ondac is offline
Registered User
 
Join Date: Aug 2005
Posts: 140
use pow function.

select valor /pow((1+0.098),10) from tab2

or

select pow(valor/(1+0.098),10) from tab2

depends what you want.
Reply With Quote
  #3 (permalink)  
Old 09-11-08, 08:10
dicipulofer dicipulofer is offline
Registered User
 
Join Date: Oct 2007
Posts: 55
Quote:
Originally Posted by stanislav.ondac
use pow function.

select valor /pow((1+0.098),10) from tab2

or

select pow(valor/(1+0.098),10) from tab2

depends what you want.


Omg..
It so easy.

I wrote the big function to work !

CREATE FUNCTION nog_calc_tx_fin(p_cnd_pgto integer,p_valor decimal(10,4),p_taxa decimal(10,4)) RETURNS decimal(10,4)
DEFINE v_prz_medio integer;
DEFINE i integer;

BEGIN

select
round(sum(b.qtd_dias_sd) / max(b.sequencia),2) as financeira into v_prz_medio
from cond_pgto a, cond_pgto_item b
where a.cod_cnd_pgto = b.cod_cnd_pgto and a.cod_cnd_pgto = p_cnd_Pgto;
let i=1;

while i <= v_prz_medio
let p_valor = p_valor - (p_valor * p_taxa / 100);
let i = i + 1;
end while

return p_valor;

END
END FUNCTION


Anyways Thanks. I`ll use pow in the next time.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On