Oracle EXP Function: A Simple Guide

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) returns e (approx 2.71828...).
  • EXP(0) returns 1 (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
Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 25+ years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments