Saturday, November 28, 2009

Diff between Function and Procedure?

1.Function is mainly used in the case where it must return a value. Where as a procedure may or may not return a value or may return more than one value using the OUT parameter.
2.Function can be called from SQL statements where as procedure can not be called from the sql statements
3.Functions are normally used for computations where as procedures are normally used for executing business logic.
4.You can have DML (insert,update, delete) statements in a function. But, you cannot call such a function in a SQL query.
5.Function returns 1 value only. Procedure can return multiple values (max 1024).

2 comments:

  1. Thanks for listing all the points of difference between function and procedure. These are most confusing terms which most of the people do thinks same. You have shared enough points to justify the fact that they both are totally different. Thanks
    sap upgrade project

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete