6
Reply

Difference Between StoredProcedure and Function

Rajesh Pathakoti

Rajesh Pathakoti

10y
1.7k
0
Reply

    Functions can be called from Procedure whereas Procedures cannot be called from Function, Function must 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 whereas Procedures can have input/output parameters

    1) Storeprocedure can return multiple values while Function returns single value2)storeprocedure can have input as well output parameters while Function can have only Input parameteres

    1. SP can have both input and O/P parameters but Fun have only have I/P parameters 2. SP can call Fun but Fun can't call SP 3.Sp can return multiple value but fun only return single value. 4. Sp only execute single time and Fun execute on each call

    1) Storeprocedure can return multiple values while Function returns single value2)storeprocedure can have input as well output parameters while Function can have only Input parameteres

    Stored Procedure Has input and out put parameter. Functions only has Input parameter. We can call function from SP but we can not call SP from UDF.

    Sotred Procedure:1) It May or Maynot be return value. 2) work under Transaction Concepts 3) work under Try catch Concepts 4) All DML,DDL operation will workFunction: 1) It should be return the value 2) will not work under Transaction Concepts 3) will not work under Try catch Concepts 4) Only DDL operations will work