Re: Select Statement

From: Dan Blum <tool_at_panix.com>
Date: Wed, 21 May 2008 18:56:22 +0000 (UTC)
Message-ID: <g11r8m$qv3$1@reader2.panix.com>


amerar_at_iwc.net <amerar_at_iwc.net> wrote:
> That sounds feasible. I'll have to read on how to pass the values of
> the selected data as bind variables:

> SELECT a + b, c * d, e + f - g
> FROM .......

> So, all those values would have to be passed to the function......the
> result would be returned. I'll need 2 arrays, one for the values and
> one for the operators. I guess the other option is to pass the entire
> statement as a string, and parse it, and then open a cursor to be read
> from.....maybe that would work too. But I'd rather just pass the
> needed values.......

Passing an array of operators won't work if you have any formulas that use parentheses to control precedence.

Really, the best way to solve the whole thing would be to go back a step, and have the values be correct at the time the formula is executed. You could insert all the values for each row you are processing in a temp table, then run a statement to change the values to 0 where necessary, then have the statement calculating the formula use that table.

-- 
_______________________________________________________________________
Dan Blum					         tool_at_panix.com	
"I wouldn't have believed it myself if I hadn't just made it up."
Received on Wed May 21 2008 - 13:56:22 CDT

Original text of this message