What is the difference between Procedure and Function ?
1. Functions are normally used for computations where as procedures are normally used for executing business logic.
2. A function returns 1 value only so function is mainly used in the case where it must return a value. Where as a procedure can return multiple values (max 1024).or may not return a value using the OUT parameter.
3. You can perform DML (insert,update, delete) statements in a procedure. You can have DML (insert,update, delete) statements in a function. But, you cannot call such a function in a SQL query.
4. A function can be called from SQL statements where as procedure can not be called from the sql statements.
5.Stored procedure is precompiled execution plan where as functions are not.