=> Stored Procedures are pre-compile objects which are compiled for first time and its compiled format is saved which executes (compiled code) whenever it is called. But Function is compiled and executed every time when it is called.
=> Function must return a value but in Stored Procedure it is optional( Procedure can return zero or n values).
=> Functions can have only input parameters for it whereas Procedures can have input/output parameters.
=> Functions can be called from Procedure whereas Procedures cannot be called from Function.
=> Procedure allows SELECT as well as
DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only
SELECT statement in it.
=> Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.
=> Exception can be handled by try-catch block in a Procedure whereas try-catch block cannot be used in a Function.
0 comments:
Post a Comment