What is the difference between "procedure" and "function"?

Questions by Beena   answers by Beena

Showing Answers 1 - 37 of 37 Answers

The difference mejor  between procedure and function is that function must return value. that should be only single and function can pass any no. parameter but come out only one value only using return statement.

procedure can pass any parameter and came out any no. of values there no any RETURN word. 

NAVEEN KUMAR

  • Sep 28th, 2005
 

The major difference between procedure and function is that procedure is to be compile only one time and vice versa.Execution of procedure is faster then function

  Was this answer useful?  Yes

NAVEEN KUMAR

  • Sep 28th, 2005
 

The major difference between procedure and function is that procedure is to be compile only one time and vice versa.Execution of procedure is faster then function

  Was this answer useful?  Yes

Ramesh. S

  • Oct 10th, 2005
 

         1.The major difference between procedure and function is that procedure is to be compile only one time.Execution of procedure is faster then function

  Was this answer useful?  Yes

Ramesh. S

  • Oct 10th, 2005
 

         1.The major difference between procedure and function is that procedure is to be compile only one time and vice versa.Execution of procedure is faster then function

        2.Function can be used in select Queries statement,but in stored procedure  it's not possible.

       3.Fuction can return a single value only.Stored procedure return more than one value.

  Was this answer useful?  Yes

Azhagu Pandian

  • Oct 17th, 2005
 

The major difference between procedure and function is that 1. Procedure can be compiled only once and vice versa. 2. Execution of procedure is faster then function 3. Function can be used in select Queries statement in stored procedure. But it's not possible using straight away. 4. Function can return a single value only.Regards,Azhagu

  Was this answer useful?  Yes

gayathri

  • Nov 4th, 2005
 

function returns a value

procedure doesnot return a value

  Was this answer useful?  Yes

kautilya

  • Nov 7th, 2005
 

SP excepts

  Was this answer useful?  Yes

kautilya

  • Nov 7th, 2005
 

SP Accepts both i/p and o/p paramateres where function accespts only i/p paramateres, fuction can be used in select stmt as well as function can be used as user defined datatype

  Was this answer useful?  Yes

ramani

  • Dec 12th, 2005
 

main difference are

Output parameters: UDF's don't have the ability to return output parameters to the calling function. They do however let us return a single scalar value or a locally created table.

Calling conventions: One of the major differences between UDF's and stored procedures is that a UDF can be called through a SQL statement without using the EXECUTE statement

  Was this answer useful?  Yes

aruna

  • Apr 3rd, 2006
 

procedure does not return any value.but function returns a value.

  Was this answer useful?  Yes

vikas

  • Jul 20th, 2006
 

The main differences are :-

1. Functions must return a value while procedure may or may not return any value.

2. Function can return only a single value at a time while procedure can return one, many or none.

3. Function can be called from sql statements while procedures can't.

Mohan Kumar E.

  • Mar 29th, 2007
 

1) Procedure return a status value which indicates failure(0) or success(1) but function return value can be any data type.
2) Procedure accepts inputvalues and  return values to the caller using output parameter.
3) Functions can be executed in a select statement but procedures can't.
4) Function are compiled as an executables and distributed and storedprocedures are meaningless outside of the sqlserver.

  Was this answer useful?  Yes

ranjeet30j

  • Nov 12th, 2007
 

One main difference is that in function DML statements cannot be used i.e. Update,delete,insert statements cannot be used inside function but in procedure it is possible.

  Was this answer useful?  Yes

chihoo2003

  • Jan 9th, 2008
 

1.Procedure: Procedure may or may not return value. It may return multiple values
   function:function should should explict return a value.

  Note: Procedure is faster than function and function is faster then views

  Was this answer useful?  Yes

The Differences are...

1.Function mainly used to calculation and Procedure is used to a business logic.

2.Function can only 1 return type where procedurwre contains many return value

3.Function must have a return value where Procedure not necessory a return value.

  Was this answer useful?  Yes

venkat.rbs

  • Feb 12th, 2008
 

1)function returns a value....
 procedure does not returns a value.....
2) in function will pass the many input parameters and wiull get only one output parameter with return value....
But  procedure we can get more than one output parameter....

  Was this answer useful?  Yes

The major difference between procedure and function is that
1. Procedure can be compiled only once and vice versa.
2. Execution of procedure is faster then function
3. Function can be used in select Queries statement in stored procedure. But it's not possible using straight away.
4. Function can return a single value only.

  Was this answer useful?  Yes

* Stored procedure contains all DML stmt to perform operation With permanent table where user define function does not contain insert, update, delete stmt to modify the permanent table.

*
Stored procedure takes input and output parameter where function takes only input parameter.


*
Stored procedure is to compile only one time. Execution of procedure is faster than function.


*
Function can return a single value only. Stored procedure return more than one value.


Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions