Tuesday, November 15, 2016

DIFFERENCE IN PACKAGE, PROCEDURE, TRIGGER

Question of the Day!!  


                
Module: Oracle Technical


Question:  WHAT IS DIFFERENCE IN PACKAGE, PROCEDURE, TRIGGER?


ANS: 

PROCEDURE:

Procedure is a program units used to store PL/SQL block     under an assigned name so that it can be called repeatedly. It may and may not     return values using out prarameters. It is invoked by its name. It cannot be     called from the SQL statement.      Return parameter is not mandatory. In case of     Function Return value is must.

PACKAGE 

is a program unit have several procedures and functions that are     logically related together. It also has PL/SQL constructs such as cursors,     variables, constants and exceptions. Packages brings these various constructs     together in a single program unit. It is invoked by its name. It can be called from     With in any other program unit.Packages A method of encapsulating and storing related procedures, functions,       and other package constructs together as a unit in the database. While packages         provide the database administrator or  application developer organizational benefits,       they also offer increased functionality and database performance.

TRIGGER:

Triggers is also a program unit. It is invoked by the event such as     insert, update and delete. It cannot be called from any other program unit.     Trigger can be associated with table, views or system level events.     TCL is not allowed within triggers (COMMIT, SAVEPOINT Or ROLLBACK).     DCL is not allowed within triggers (GRANT & REVOKE).     We cannot use parameter in Triggers.



No comments: