What is difference between a PROCEDURE & FUNCTION ?

What is difference between a PROCEDURE & FUNCTION ?

What is difference between a PROCEDURE & FUNCTION ?

View Answers

November 19, 2010 at 5:05 PM

Hi,

There are the several differences which are as follows-

1-Stored procedure will be used for perform specific tasks and Normally functions will be used for computing value.

2-Stored procedures may or may not return values But function should return value.

3-Stored procedure cannot be used in the select/where/having clause But function can be called from select/where/having clause.

4-Stored procedure can run independently. It can be executed using EXECUTE or EXEC command But function cannot run independently.

5-Temporary table (derived) cannot be created on function But it can be created in stored procedures.

6-Stored procedure can call the user defined functions But the function cannot call the stored procedures.

7-Stored procedures can have input and output parameters But the function can have only input parameters.

Thanks.









Related Tutorials/Questions & Answers:

Ads