pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
String Formula  to calculate the value
3+ messages / 3 participants
[nested] [flat]

* String Formula  to calculate the value
@ 2009-04-08 11:56  ram subbu <ramgv80@yahoo.com>
  0 siblings, 2 replies; 3+ messages in thread

From: ram subbu @ 2009-04-08 11:56 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; pgsql-jdbc; pgsql-jdbc

Dear All,
    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.


      

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: String Formula  to calculate the value
@ 2009-04-09 05:49  Albe Laurenz *EXTERN* <laurenz.albe@wien.gv.at>
  parent: ram subbu <ramgv80@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Albe Laurenz *EXTERN* @ 2009-04-09 05:49 UTC (permalink / raw)
  To: ram subbu *EXTERN* <ramgv80@yahoo.com>; 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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: String Formula  to calculate the value
@ 2009-04-09 06:47  Peter <peter@greatnowhere.com>
  parent: ram subbu <ramgv80@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Peter @ 2009-04-09 06:47 UTC (permalink / raw)
  To: pgsql-jdbc

You could use plPerl – it is very  well suited for string manipulation. Also there is eval() function that can be used for formulas like yours.

 

From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of ram subbu
Sent: Wednesday, April 08, 2009 2:56 PM
To: Kris Jurka; pgsql-jdbc@postgresql.org; pgsql-jdbc@postgresql.org
Subject: [JDBC] String Formula to calculate the value

 

Dear All,

    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.

 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2009-04-09 06:47 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08 11:56 String Formula  to calculate the value ram subbu <ramgv80@yahoo.com>
2009-04-09 05:49 ` Albe Laurenz *EXTERN* <laurenz.albe@wien.gv.at>
2009-04-09 06:47 ` Peter <peter@greatnowhere.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox