What is difference between Procedures and Functions ?

A Function returns a value to the caller where as a Procedure does not.

Showing Answers 1 - 1 of 1 Answers

Michael Streeter

  • Nov 17th, 2005
 

A procedure can return a value (or values) via any parameters declared as IN OUT !

Procedure A Procedure is a subprogram that performs a specific actionProcedure Does and Does not return the Value.Procedure we can use (In, Out, InOut Parameter)You cannot use the procedure in Select Statement.Execute as a PL/SQL statementNo RETURN clause in the headerCan return none, one, or many values  FunctionA Function is a subprogram that computes a valueInvoke as part of an expressionMust contain a RETURN clause in the headerMust return a single valueMust contain at least one RETURN statementAlways return the Value.Function you cannot use the (In, Out, InOut Parameter)You can use the Function the in Select Statement.

  Was this answer useful?  Yes

chloroone

  • Aug 6th, 2008
 

Function always returns a value. Procedure may or may not return a value.

Functions can be called in SQL statements. Procedure can not be called in an SQL statement.

  Was this answer useful?  Yes

Procedure is to do specific task where as function is to compute values.
Procedure may or may not return value at all, but function must return value.
Function can be used in SQL statement but Procedure is not used.

  Was this answer useful?  Yes

Procedure executes as a part of PL/SQL block wherein Function invoked as part of expression.

Function must have RETURN keyword in the header , which is not applicable for Procedure.

Function must return a value and could be used in SELECT statement provided that the function doesn't have any Data Manipulation inside & should not have any OUT, IN OUT parameters.

Function with return type BOOLEAN couldn't be used in SELECT statement.

  Was this answer useful?  Yes

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