Home » SQL & PL/SQL » SQL & PL/SQL » Function&Procedure
Function&Procedure [message #204966] Wed, 22 November 2006 23:36 Go to next message
balumeignanam
Messages: 8
Registered: November 2006
Location: Bangalore
Junior Member

Hi all

What is the main difference between function and procedure with out the return values...
Re: Function&Procedure [message #205007 is a reply to message #204966] Thu, 23 November 2006 00:49 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How do you mean "without return value"? Function MUST have a return value.

Besides, click on this smiley to find more differences ./fa/456/0/
Re: Function&Procedure [message #205008 is a reply to message #204966] Thu, 23 November 2006 00:49 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Other than the return value, nothing, except the way in which they are called.

Procedures can be called in one of two ways:

  • As a single PL/SQL statement inside a PL/SQL block
  • As a single SQL statement using the SQL "CALL procname(...)" syntax.


Functions can be called in one of three ways:

  • As a PL/SQL expression inside a PL/SQL statement eg. x := 2 * my_func(...)
  • As an expression in a SQL statement. eg. select func(...) from dual
  • As a table expression eg. select * from table(func(..))


[Edit] Dammit - @LF beat me to it

Ross Leishman

[Updated on: Thu, 23 November 2006 00:50]

Report message to a moderator

Re: Function&Procedure [message #205250 is a reply to message #205008] Fri, 24 November 2006 01:11 Go to previous messageGo to next message
monikagupta
Messages: 8
Registered: June 2006
Junior Member
Hi,
I think one of the main difference is ,Function can be used in the select clause of a query but a procedure cannot be used in a select query.


Re: Function&Procedure [message #205551 is a reply to message #205250] Sat, 25 November 2006 20:01 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Hey, thanks monikagupta, I must have missed that one... ./fa/1600/0/ Wait a minute, I did mention that. Thanks for clearing up... well... nothing.
Re: Function&Procedure [message #205554 is a reply to message #205551] Sat, 25 November 2006 22:12 Go to previous message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

Hi

As an expression in a SQL statement. eg. select func(...) from dual

YOu already mention that..
Previous Topic: about Indexes,help me
Next Topic: procedure is advantageous than trigger ? Urgent
Goto Forum:
  


Current Time: Sat Dec 03 14:14:06 CST 2016

Total time taken to generate the page: 0.04308 seconds