Professional Documents
Culture Documents
Function vs. Procedure
Function vs. Procedure
Functions always return a value after the The procedure can return a value using
1.
execution of queries. “IN OUT” and “OUT” arguments.
Each and every time functions are compiled Procedures are compiled only once but
3. they provide output according to the given they can be called many times as needed
input. without being compiled each time.
The function can be called using Stored While procedures cannot be called from
5.
Procedure. function.
The return statement of a function returns the While the return statement of the
7. control and function’s result value to the procedure returns control to the calling
calling program. program, it can not return the result value.
The function does not support try-catch Procedure supports try-catch blocks for
8.
blocks. error handling.
A function can be operated in the SELECT While it can’t be operated in the SELECT
9.
statement. statement.
S.NO Function Procedure
In functions, we can use only a table variable. In procedures, we can use temporary
11. Temporary tables can not be created in tables or table variables to store temporary
function. data.