Home » SQL & PL/SQL » SQL & PL/SQL » diffence between procedure and function.
diffence between procedure and function. [message #288965] Wed, 19 December 2007 02:56 Go to next message
it_me24
Messages: 167
Registered: March 2006
Location: delhi
Senior Member
Hi All,

As far i know the basic difference between function and procedure is "Function can return a value but a procedure cannot".

but as far as PL/SQL is concerned, we can use IN/Out parameter in the procedure.

If procedure cannot return a value then why IN/Out parameter is there in PL/SQL.

Or what is the diffence between procedure and function then.


Regards.
MH
Re: diffence between procedure and function. [message #288969 is a reply to message #288965] Wed, 19 December 2007 03:02 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
The main difference in my opinion :

When you have created a function, you can use that function in normal SQL queries.

[Updated on: Wed, 19 December 2007 03:02]

Report message to a moderator

Re: diffence between procedure and function. [message #288971 is a reply to message #288965] Wed, 19 December 2007 03:13 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Function is the only way to return a value to a SQL statement.

Regards
Michel
Re: diffence between procedure and function. [message #288977 is a reply to message #288965] Wed, 19 December 2007 03:27 Go to previous messageGo to next message
it_me24
Messages: 167
Registered: March 2006
Location: delhi
Senior Member
Thanks a lot for your reply.

What makes me confused is why we use Out Parameter in procedure.

if we use the Out parameter in procedure then procedure will also return the value in this case.

Please Clearify.
Re: diffence between procedure and function. [message #288978 is a reply to message #288977] Wed, 19 December 2007 03:28 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:

procedure will also return the value in this case.

Yes but it can't be used in SQL only in PL/SQL.

Regards
Michel
Re: diffence between procedure and function. [message #288980 is a reply to message #288965] Wed, 19 December 2007 03:29 Go to previous message
it_me24
Messages: 167
Registered: March 2006
Location: delhi
Senior Member
Alright....Got it.

Thanks a Lot.
Previous Topic: Updating multiple records
Next Topic: External table
Goto Forum:
  


Current Time: Sat Dec 10 22:48:00 CST 2016

Total time taken to generate the page: 0.06758 seconds