Qus:    What is the difference between Function and Stored procedure?
Oct 09, 2020 07:19 DotNet 2 Answers Views: 1355 KRISHNA SWAROOP
Prev Next
Answers (2)
SAI Oct 10, 2020 09:15
Answer:   Stored Procedure:
• A Stored Procedure is always used to perform a specific task.
• It can return zero, one or more value.
• It can have both input and output parameters.
• Exception handling can be done using a try-catch block.
• A function can be called from a Procedure.

PARTH Oct 10, 2020 13:18
Answer:   1. You can use Transactions in Procedure. But, you can’t use Transactions in Function.

2. By using a try-catch block, an exception can be handled in a Procedure. Whereas, you can’t use try-catch block in a Function to handle the exception.

3. You can’t utilize Procedures in a SELECT statement. But Function can be utilized in a SELECT statement.

4. The procedure allows as DML(INSERT/UPDATE/DELETE) as well as a SELECT statement in it. Whereas, Function allows only SELECT statement in it.

5. Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT statement. The function can be used in the SQL statements anywhere in SELECT/WHERE/HAVING syntax.

Post Your Answer
Guest User

Not sure what solution is right for you?

Choose the right one for you.
Get the help of the experts and find a solution that best suits your needs.


Let`s Connect