Tuesday, May 15, 2012

Difference between store procedure and Function

Function
  1. Should return at least one output parameter, it can return more than one parameter using OUT argument
  2. Parsed and compiled at runtime
  3. Cannot affect the state of database
  4. Can be invoked from SQL statement eg. SELECT fnname()
  5. functions are mainly used to compute values
Procedure
  1. Doesnot return value but can return value (by OUT parameter)
  2. Stored as Psedo-code in database i.e complied form
  3. Can affect the state of database using committ etc
  4. Cannot be invoked from SQL statement ex. SELECT
  5. procedures are mainly used to process the task

No comments:

Post a Comment