Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Execute some basic math in a single SQL
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-lReceived on Mon Mar 26 2007 - 16:59:40 CDT
![]() |
![]() |