GeekInterview.com
Series: Subject: Topic:
Question: 115 of 118

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

Asked by: Beena | Member Since Sep-2005 | Asked on: Sep 19th, 2005

View all questions by Beena   View all answers by Beena

Showing Answers 1 - 21 of 21 Answers
rahultripathi

Answered On : Sep 20th, 2005

View all answers by rahultripathi

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. 

Yes  1 User has rated as useful.
  
Login to rate this answer.
NAVEEN KUMAR

Answered On : 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

  
Login to rate this answer.
NAVEEN KUMAR

Answered On : 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

  
Login to rate this answer.
Ramesh. S

Answered On : 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

  
Login to rate this answer.
Ramesh. S

Answered On : 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.

  
Login to rate this answer.
Azhagu Pandian

Answered On : 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

  
Login to rate this answer.
Ramesh

Answered On : Oct 21st, 2005

differece

Yes  1 User has rated as useful.
  
Login to rate this answer.
gayathri

Answered On : Nov 4th, 2005

function returns a value

procedure doesnot return a value

  
Login to rate this answer.
kautilya

Answered On : Nov 7th, 2005

SP excepts

  
Login to rate this answer.
kautilya

Answered On : 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

  
Login to rate this answer.
ramani

Answered On : 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

  
Login to rate this answer.
aruna

Answered On : Apr 3rd, 2006

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

  
Login to rate this answer.
vikas

Answered On : 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.

Yes  2 Users have rated as useful.
  
Login to rate this answer.
Mohan Kumar E.

Answered On : 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.

  
Login to rate this answer.
ranjeet30j

Answered On : 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.

  
Login to rate this answer.
robinjoseph100

Answered On : Dec 18th, 2007

View all answers by robinjoseph100

A Function can return a value where as a procedure cannot return a value

  
Login to rate this answer.
chihoo2003

Answered On : Jan 9th, 2008

View all answers by chihoo2003

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

  
Login to rate this answer.

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.

  
Login to rate this answer.
venkat.rbs

Answered On : Feb 12th, 2008

View all answers by venkat.rbs

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....

  
Login to rate this answer.
praveen34.tit

Answered On : Apr 2nd, 2009

View all answers by praveen34.tit

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.

  
Login to rate this answer.
sushilmishra

Answered On : Jun 8th, 2009

View all answers by sushilmishra

* 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.


Yes  1 User has rated as useful.
  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.