Thursday, August 16, 2012

Difference between Stored Procedure and Function?

Answer:

Function are compiled and executed at run time.

Stored Procedure are stored in parsed and compiled format in the database.

Function cannot affect the state of the database which means we cannot perform CRUD operation on the database.

Stored Procedure can affect the state of the database by using CRUD operations.

Store Procedure can return zero or n values whereas Function can return only one value.

Store Procedure can have input,output parameters for it whereas functions can have only input parameters.

Function can be called from Stored Procedure whereas Stored Procedure cannot be called from Function.

No comments:

Post a Comment