The EXP function in Oracle SQL is a mathematical function that returns the value of the constant e (approximately 2.71828183) raised to the power of a given number.
This is the inverse of the LN (Natural Logarithm) function and is widely used in scientific and financial calculations, such as for compound interest or modeling exponential growth.
What is the EXP Function in Oracle?
The EXP function takes a single number n and calculates e^n.
EXP(1)returnse(approx 2.71828...).EXP(0)returns1(since any number raised to the power of 0 is 1).
EXP Function Syntax
The syntax for EXP is very simple:
EXP(n)
Let's break that down:
n: The number (or "exponent") you want to raise e to.
Oracle EXP Function Examples
Here are two practical examples of how to use EXP.
Example 1: Finding the Value of e
To get the value of the constant e itself, you can ask for e raised to the power of 1.
Query:
SELECT
EXP(1) AS "Value_of_e"
FROM DUAL;
Result:
Value_of_e
-----------
2.71828183
Example 2: Calculating e Raised to a Power
This example calculates e raised to the 3rd power.
Query:
SELECT
EXP(3) AS "e_to_the_3rd"
FROM DUAL;
Result:
e_to_the_3rd
------------
20.0855369
