List the Major Difference between function and Stored Procedure?

Total Post:123

Points:615
 362  View(s)
Ratings:
Rate this:
  1. Post:123

    Points:615
    List the Major Difference between function and Stored Procedure?

    There are many differences between function and stored procedure some of them are-

    • In function it is necessary to return a value but in Stored Procedure it is optional (Procedure can return zero or n values).
    • Functions can have only input parameters for it but Procedures can have input/output parameters.
    • We can call Functions from procedure but Procedures cannot be called from Function.
    • Procedure gives the facility to select as well as DML (INSERT/UPDATE/DELETE) statement in it but in Function allows only SELECT statement in it.
    • Procedures cannot be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement.
    • Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be.
    • We can use try catch in procedure but try-catch cannot be used in function.

Answer