Hi friends,

We all are aware of functions and procedures used in various programming languages. But many of us sometimes get confused between both.

Come, Let’s point out some differences between a function and a procedure.

A Function must return a value.
While a Procedure can’t return a value.
However, both procedures and functions can return data using OUT and IN OUT parameters.

Functions can be called from SQL query.
Whereas, procedure cannot be called from SQL query.

A function’s return statement returns control to the calling program and also the result value of the function.
A procedure’s return statement returns control to the calling program but can’t  return a value.

Functions are compiled each time they are called.
While, procedures are compiled just once and can be called repeatedly as required without being compiled every time.

A Function is considered as an expression.
But a procedure is not considered as an expression.

 

Stay tuned… 🙂