Home » Other » Training & Certification » Procedure vs Function (Oracle 9.2.0.3, Windows XP)
Procedure vs Function [message #361107] Tue, 25 November 2008 01:27 Go to next message
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 #361114 is a reply to message #361107] Tue, 25 November 2008 01:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68722
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
No, procedure can't be called in SQL.

Regards
Michel
Re: Procedure vs Function [message #361148 is a reply to message #361107] Tue, 25 November 2008 03:15 Go to previous messageGo to next message
raja.or.king
Messages: 24
Registered: November 2008
Location: GJ 5
Junior Member
Also that we cant use function in expression
Re: Procedure vs Function [message #361164 is a reply to message #361107] Tue, 25 November 2008 04:26 Go to previous message
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
Previous Topic: How duplicates can be removed from an array in oracle
Next Topic: Oracle financials- functional
Goto Forum:
  


Current Time: Wed Dec 11 15:17:10 CST 2024