Difference Between Functions And Store Procedure

Store Procedure

  • Store Procedure may not return value.
  • It can Used DDL,DML Command
  • Store Procedure can have input and output parameter.
  • Store Procedure can used try, catch blocks
  • Used Transaction within Store procedure
  • Store Procedure can call function.
  • Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section.

Function

  • Function Must Return a Value.
  • It can only select statements. It cannot used DML Command.
  • Function Only Input parameters.
  • Function cannot used try,catch blocks.
  • Transaction are not allowed within function.
  • Procedure cannot call from function.
  • Function can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section.