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.
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.
Package: A Collection of related variables,cursor,procedure,and functions Package will support oops features like encaplution and data hiding and function overloading(8.0), to declare package in 2 steps 1.package specification 2.package body SubPrograms: A set of pl/sql statements is stored in database and used to perform a task; there are 2 types of subprograms 1.Procedures 2.Functions Procedure:A subprogram type perform a task and will not return value. and used to perform dml operations on database Function:A subprogram type perform a task and may or may not return value,but it will return only one value.
5 People are following this question.