Saturday 23 July 2016

What is difference between Package and Stored Procedure?

Package:
  • A package is a group of PL/SQL types, objects, stored procedures and functions. it has two parts one is specification other is body.
  • In specification we mention procedures, functions & its parameters.
  • In body part we define whole operation performed by procedures and functions mentioned in specification part.
  • You can make your procedure private to the package by not declaring it in the package specification.
  • packages cannot be called, passed parameters, or nested
  • While calling a procedure from a package whole of the package loaded into the memory. Like if a package consists of 4 procedures & we call 1 procedure then whole 4 would be loaded to memory.
Procedure:
  • Procedure is a standalone pl/sql unit in which all things related to procedure define in one go i.e parameters and whole functionality etc
  • A procedure is a stored program in oracle that is written down when a particular task has to be done.
  • A procedure that resides in a package has to be called as <package_name>.<procedure_name>. On the other hand a standalone procedure can be called by its name alone.
  • We can pass IN, OUT parameters in procedure.

No comments:

Post a Comment