How to use math formula in PL/SQL

# Thread: How to use math formula in PL/SQL

1. Junior Member
Join Date
Apr 2002
Posts
61

## How to use math formula in PL/SQL

I am planning to write a PL/SQL procedure to perform some math calculations. The math formulas has 'log' function with base 2. [ e.g. log2(25) ]. Would you please provide me your feedback on how to code this in SQL.

The complete formula is something like this.

log2(x1)-log2(x2)-log2(x3)

x1,x2,x3 are the column names in my oracle table and I need to calculate the value for each row in the table using above formula.

Thanks,
Ramesh

2. log(a,b) returns the log, base a of b

log(2,x1)-log(2,x2)-log(2,x3)

3. However, what is the relationship among x1, x2, and x3? I'm trying to think of a mathematical situation where you would be subtracting successive logs beyond the case of log x - log y.

log(2/3) = log 2 - log 3

If you have x1/x2, and then divided by x3, or x1 divided by x2/x3, then your equation would make sense. You could do log(2,x1/x2) - log(2,x3), or log(2,x1) - log(2,x2/x3).

4. Junior Member
Join Date
Apr 2002
Posts
61

## Thanks

Actually, I have x3/x4, etc.. in place of variables x1,x2,x3 that I stated for simplicity. Your feedback provides answer to my question.
Thanks again.
Ramesh

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•