ProAnswers.org

What are the Difference between Functions and Procedures

What are the Difference between Functions and Procedures ?

  1. Functions are used for computations where as Procedures can be used for performing business logic
  2. Functions MUST return a value, Procedures need not be.
  1. you can have DML(insert, update, delete) statements in a Function. But, you cannot call such a function in a SQL query…
    eg: suppose, if u have a function that is updating a table… you can’t call that function in any sql query. - select myFunction(field) from sometable; will throw error.
  2. function parameters are always IN, no OUT is possible
  3. function returns 1 value only. procedure can return multiple values(max. 1024)
  4. we can select the fields from function.in the case of procdure we cannot select the fields.
  5. Function do not return the images,text whereas stored procedures returns all