tech on the net
Home About Us Feedback Site Map


Access Excel Word


SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker


C Language


ASCII Table Linux UNIX Java Clipart Joke of the Moment

Other Sites

CheckYourMath BigActivities DigMinecraft
Share this page:

Oracle/PLSQL: Execute a function that is defined in a package

Question: How can I execute a function that is defined in a package using Oracle/PLSQL?

Answer: To execute a function that is defined in a package, you'll have to prefix the function name with the package name.

package_name.function_name (parameter1, parameter2, ... parameter_n)

You can execute a function a few different ways.

Solution #1

First, we'll take a look at how to execute a function using a test block. Below we've declared a variable called result that is a number. We've passed in a value of 15000 into the function and the result of the function will be returned to the variable called result.

   result number;
   -- Call the function
   result := package_name.function_name (15000);

Solution #2

We can also execute a function by running a SQL statement. For example:

select package_name.function_name (15000)
from dual;