I need the differences bettwen a FUNCTION, PROCEDURE and PACKAGE in Oracle. Which one is better to use in most of the times ? Thank you.
asked Jan 05, 2010 at 11:41 AM in Default
Functions return a value, procedures don't, otherwise they're identical.
A Package is a container that may have many functions and procedures within it. It provides useful capabilities such as scoping, interface definition and modular development.
It's generally advisable to put your procedures and functions into packages with well designed interfaces.
answered Jan 05, 2010 at 11:46 AM
The most important difference between procedure and a function is: procedure is compiled only once. Function is compiled every time you call it. So basically stored procedure is more efficient than function. Both function and procedure return a value. As mentioned above, package is like a container for function and stored procedure. It is like a way to define API. Once you define your Package, you can access it from outside just alike any API.
answered Oct 03, 2014 at 10:03 AM