Procedure vs Function [message #361107] |
Tue, 25 November 2008 01:27 |
avik2009
Messages: 61 Registered: November 2008
|
Member |
|
|
Procedure may or may not return a value. But a function always return a value.Can we use procedure everytime instead of function.
|
|
|
|
|
Re: Procedure vs Function [message #361164 is a reply to message #361107] |
Tue, 25 November 2008 04:26 |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
avik2009 wrote on Tue, 25 November 2008 08:27 | Procedure may or may not return a value. But a function always return a value.Can we use procedure everytime instead of function.
|
Actually, you got it wrong.
Procedures do not "return a value". It can however change the value of one or more of its parameters (defined as OUT or IN OUT).
SQL> create procedure tst_prc
2 as
3 begin
4 return 1;
5 end;
6 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE TST_PRC:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/3 PL/SQL: Statement ignored
4/3 PLS-00372: In a procedure, RETURN statement cannot contain an
expression
|
|
|