Wednesday 26 September 2012

What is the difference between stored procedure and function?



Hi friend , here i have explained "What  is the difference between stored procedure and function "
1.)Stored procedure can return  zero or more  means 0 or n values where as function can return only one value which is mandatory.
2.) Stored procedure have input , output parameters for it  whereas function can have only input parameters.
3.)Stored procedure allows to select as well as DML statement in it whereas function allows only select statement in it.
4.)Stored procedure can called a function whereas function can not called a stored procedure.
5.) Exception can be handled by try –catch block in a stored procedure but try-catch  block cannot be used in a function.
6.)We can go for transaction management in stored procedure but we cannot go in function.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.