Friday, December 14, 2018

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 the body.
  • In the specification, we mention procedures, functions & their parameters.
  • In the body part, we define the whole operation performed by procedures and functions mentioned in the 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 is loaded into the memory. Like if a package consists of 4 procedures & we call 1 procedure then the whole 4 would be loaded to memory.
Procedure:
  • The 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 an 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 the procedure.

No comments:

Post a Comment