Re: Dynamic SQL

From: Gerard H. Pille <ghp_at_skynet.be>
Date: Fri, 22 Oct 2010 16:54:37 +0200
Message-ID: <4cc1a5ac$0$14255$ba620e4c_at_news.skynet.be>



The Magnet wrote:
>
> Hi, I'm looking for an answer but also thought I can take a shortcut
> here.
>
> We have a query with a ton of calculations using DECODE and NULLIF and
> more and more. So, we created a function in which we will pass a pair
> of values in a string (number,'operator'):
>
> CALC_FORMULA(x,'-',y,'+',z,'*')
>
> My question is, with all that dynamic stuff, can I perform the
> calculation? I mean, the operators are variables. So, is it as
> simple as constructing a string and using like EXECUTE IMMEDIATE?
>

You must have a system to spare?

You'll be calling PL/SQL from your SQL, which in its turn will call SQL to parse and execute that formula.

I've seen worse attempts to drown a machine. Received on Fri Oct 22 2010 - 09:54:37 CDT

Original text of this message