Qus:    What are differences between function and stored procedure in .Net programming language?
Nov 05, 2020 05:21 2 Answers Views: 635 RITA

 



1. The procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it.



2. Procedures cannot be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.



3. Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.



4. An exception can be handled by try-catch block in a Procedure whereas try-catch block cannot be used in a Function.



5. We can use Transactions in Procedure whereas we can't use Transactions in Function.

Prev Next
Answers (2)
RAMU Nov 06, 2020 02:06
Answer:   The difference between function and stored procedure:
o Function returns only one value but procedure can return one or more than one value.
o Function can be used in select statements but procedure cannot be used.
o Function has only input parameters while Procedure can have an input and output parameters.
o Exceptions can be handled by try catch block in procedures but that is not possible in function.

PARTH Nov 10, 2020 08:40
Answer:   1. The procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it.

2. Procedures cannot be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.

3. Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.

4. An exception can be handled by try-catch block in a Procedure whereas try-catch block cannot be used in a Function.

5. We can use Transactions in Procedure whereas we can't use Transactions in Function.

Post Your Answer
Guest User

Not sure what course is right for you?

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


Let`s Connect