Qus:    What is the difference between Function and Stored procedure?
Oct 09, 2020 02:19 2 Answers Views: 802 KRISHNA SWAROOP
Prev Next
Answers (2)
SAI Oct 10, 2020 04: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 08: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 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