The function is compiled every timeit is called for execution. | Procedures are pre-compiled and saved. They execute the pre-compiled code whenever called. |
Can be called from SQL statements. | Can not be called from SQL statements. |
The function has to return a value. | Need not return any value. |
Generally used for computation purpose. | Used for executing complex business logic. |
Can return multiple values using other methods, otherwise, return only a single value. | Can return multiple values |
Returns scalar data types. | Returns an int by default. |
A stored procedure can not be called from a function | The procedure can call any function |
Functions can be embedded in a select statement | Inside a select statement, a procedure cannot be called. |
Exception handling is not possible | Try/catch block can be defined inside a procedure |