Pages

Tuesday, March 19, 2013

Differences between Stored Procedure and Functions?

Stored Procedure
Functions
Stored procedure may or may not return values.Function should return at least one output parameter. Can return more than one parameter using OUT argument.
Stored procedure can be used to solve the business logic.Function can be used to calculations
Stored procedure is a pre-compiled statement.But function is not a pre-compiled statement.
Stored procedure accepts more than one argument.Whereas function does not accept arguments.
Stored procedures are mainly used to process the tasks.Functions are mainly used to compute values
Cannot be invoked from SQL statements. E.g. SELECTCan be invoked form SQL statements e.g. SELECT
Can affect the state of database using commit.Cannot affect the state of database.
Stored as a pseudo-code in database i.e. compiled form.Parsed and compiled at runtime.

No comments:

Post a Comment