Wednesday, January 28, 2015

Difference between Stored Procedures and Functions


Stored Procedures Functions
Stored procedures are stored in parsed and compiled format in the database. Functions are compiled and executed at run time.
Stored procedures can not be called in SQL statement like Select. Functions can be called in SQL statement like Select.
Stored procedures are usually used for Business logic. Functions are normally used for computations.
Stored procedures can contain DML statements. Functions can not contain DML statements.
Exception can be called in stored procedure by TRY-CATCH Block. Exception can not be used in Function
Stored Procedure may or may not return a value. Function will always return a value & it can be only single value.
Transaction management is possible in Procedure Transaction management Is not possible in Function
A Function can be called inside a stored procedure A stored procedure can not be called inside a function.

No comments:

Post a Comment

Popular Posts