![]() |
Stored procedure vs Function |
- Stored procedure (SP) does not return a value, if we try to return some value it will throw an error. But we can use only the return statement and without a return value inside a procedure to return the control to the calling environment of the procedure. But user-defined function must return a value because of this one has to define the return type of the function in the function definition itself.
- An SP cannot be called from a DML statement, but a function can be called from a DML statement (but if a function contains an update statement, in that case we cannot call this function from a select/update/merge statement ).
- SP can include IN, OUT, INOUT parameters but in function all parameters are by default IN parameters.
2 Comments
Very useful.waiting for more blogs
ReplyDeleteNice blog. A few examples would enrich this
ReplyDeletePost a Comment