Mutltiply two numbers using Exponential Functions
I have never used Exponential Functions - I found this in OTN Forums & this was one of the best uses of Exponential functions that I ever found :-
1. Pick a query that returns two numbers in two rows :-
SELECT 2 NUM FROM dual
UNION
SELECT 3 NUM FROM dual
This returns 2 & 3.
2. Multiply using the query :-
SELECT
EXP (SUM (LN (num))) product
FROM (SELECT 2 num
FROM DUAL
UNION
SELECT 3 num
FROM DUAL);
This is simple Exponential Maths :- logE(A) + logE(B) = logE(A+B). logE raised to the power of e ( facilitated by the EXP Function ) cancles out logE, leaving simply the product AB.

0 Comments:
Post a Comment
<< Home