Difference between Function and Stored Procedure
- Compiled and executed at Run time.
- Can not affect the Database state. i.e Can not perform insert,delete and update operation.
- Can return 1 value which is mandatory.
- Can have Input parameters only.
- Function can not call Stored Procedure .
- Exception can not be handled by using try/catch block.
- Can not go for Transaction Management.
- Functions can be embeded in Select statement.
- Stored in Parsed and compiled format in database.
- Can Affect the database state by using DML commands.
- Can return 0 or n value .
- Can have Input and output parameters.
- Stored Procedure can call Function .
- Exception can be handled by using try/catch block.
- Can go for Transaction management.
- It can not be embeded in Select statement.