Skip site navigation (1) Skip section navigation (2)

Re: String Formula to calculate the value

From: "Albe Laurenz *EXTERN*" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "ram subbu *EXTERN*" <ramgv80(at)yahoo(dot)com>,<pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: String Formula to calculate the value
Date: 2009-04-09 05:49:11
Message-ID: D960CB61B694CF459DCFB4B0128514C202FF6554@exadv11.host.magwien.gv.at (view raw or flat)
Thread:
Lists: pgsql-jdbc
ram subbu wrote:
>     I am having a formula String
> say====> (a+b*c)/2
> I need to pass the dynamic value to these a,b,c 
>  
> and i need to calculate the value.
> please help me out to write a procedure to do all these stufs.

The easiest way I can think of is to use string replacement to
replace the letters with the numbers. You can do that in Java,
but also in a PL/pgSQL function.

Then execute "SELECT <formula after replacement>", which will give
you the result.

Yours,
Laurenz Albe

In response to

pgsql-jdbc by date

Next:From: PeterDate: 2009-04-09 06:47:27
Subject: Re: String Formula to calculate the value
Previous:From: Oliver JowettDate: 2009-04-09 00:19:56
Subject: Re: Array passing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group