Difference between Stored procedure and Function
1.
Procedure
can return zero or n values whereas function
can return one value which is mandatory.
2.
Procedure
can have input/output parameters for it but functions can have only input parameters.
3.
Procedure
allows select as well as DML statement in it whereas function allows only select statement in it.
4.
Procedure
cannot be called from function but Functions
can be called from procedure.
5.
Exception can be handled by try-catch block in a
procedure whereas try-catch block
cannot be used in a function.
6.
Procedure
can’t be utilized in a select statement whereas function can be embedded in a select statement.
7.
Function
can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section but
procedure cannot be.
8.
Functions
that return tables can be treated as another rowset. This can be used in JOINs
with other tables.
0 comments: