Stored Procedure V/S Function
There are following difference between stored procedure and user defined function:-
- We can use all DML command like insert, update and delete and select command in stored procedure but user defined function can use only select statement.
- Function must have to return a value but in case stored procedure it is not mandatory.
- We can call function from stored procedure but we can’t call stored procedure from function.
- We can use function in select statement and can use its output with select query but we can’t call stored procedure from select query. We need to use exec command to execute stored procedure.
- We can’t use transactions and exception handling in function but stored procedure support both transactions and exception handling.
- Function support only input parameter not ouput parameter but in stored procedure we can use both.
- User defined function can return only single value but stored procedure can return multiple value result set.
For any query you can send mail at email@example.com