Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Execute some basic math in a single SQL

Execute some basic math in a single SQL

From: Brady, Mark <Mark.Brady_at_Constellation.Com>
Date: Mon, 26 Mar 2007 17:59:40 -0400
Message-ID: <72AB68B424526641A8514835270C2EB5079BF8@EXM-OMF-21.Ceg.Corp.Net>


Without a UDF....

I have data that is a number and a formula - one row would look like this:

select 2 num, 'X + X' formula from dual

The formula has 1 variable only but it can be repeated more than once.

with data_looks_like_this as (select 2 num, 'X + X' formula from dual) select num, formula, replace(formula, 'X', num) f from data_looks_like_this

Column f now has 2 + 2

Can I possibly get a 4?

select 2 + 2 from dual

does result in 4.

It seems you should be able to say treat column f not as a char or a number but as if you saw only what is there.

>>> This e-mail and any attachments are confidential, may contain legal, professional or other privileged information, and are intended solely for the addressee. If you are not the intended recipient, do not use the information in this e-mail in any way, delete this e-mail and notify the sender. CEG-IP1

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Mar 26 2007 - 16:59:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US