Home » SQL & PL/SQL » SQL & PL/SQL » use of functions and procedure (toad, winxp)
use of functions and procedure [message #308079] Fri, 21 March 2008 01:31 Go to next message
sharathmpatil
Messages: 38
Registered: February 2008
Location: Bangalore
Member

Hi,
When to use a function and when to use a procedure?
I ve been asked this same question in many interviews.Please suggest me the best answer for this.

Thanks in advance
Re: use of functions and procedure [message #308087 is a reply to message #308079] Fri, 21 March 2008 01:44 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is NOT an expert question. Why did you post this in expert forum and not in newbie one?

It is clearly stated in the forum description: "Newbies should not post to this forum!"
Expert notion is defined in the sticky: Not an EXPERT? Post in the NEWBIES forum, NOT here
Rules are described in: OraFAQ Forum Guide

Regards
Michel
Re: use of functions and procedure [message #308113 is a reply to message #308079] Fri, 21 March 2008 04:10 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Did you even consider doing a google search for that info (obviously not, because if you had, you would have easily found the answer)
Re: use of functions and procedure [message #308236 is a reply to message #308079] Sat, 22 March 2008 10:33 Go to previous messageGo to next message
bookiant
Messages: 7
Registered: March 2008
Junior Member
I am a Junior for Oracle programming.

Having result? Function.
Having no result? Procedure.

[Updated on: Sat, 22 March 2008 10:34]

Report message to a moderator

Re: use of functions and procedure [message #308239 is a reply to message #308236] Sat, 22 March 2008 11:01 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Junior or not this has been asked many times and you can have the answer with a little search.

In addition, if you are a junior, "Why did you post this in expert forum and not in newbie one?"

Regards
Michel


Re: use of functions and procedure [message #308240 is a reply to message #308239] Sat, 22 March 2008 11:51 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
I interpreted bookiant's reply as an answer, not as a question..

[Edit: typo in name]

[Updated on: Sat, 22 March 2008 11:51]

Report message to a moderator

Re: use of functions and procedure [message #308241 is a reply to message #308240] Sat, 22 March 2008 12:37 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Oh! Really? Maybe...
In this case, it is a little bit short... and wrong. Smile

Regards
Michel
Re: use of functions and procedure [message #309254 is a reply to message #308241] Wed, 26 March 2008 22:34 Go to previous messageGo to next message
bookiant
Messages: 7
Registered: March 2008
Junior Member
I'm sorry. My English is very poor.

I want to answer this question. Maybe I am wrong. Please tell me.Thank you.
Re: use of functions and procedure [message #309257 is a reply to message #309254] Wed, 26 March 2008 22:53 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Use Function when u want some functionality as part of select statement.But there are certain restrictions on functions which can be called as part of sql statement.

Example:-

   select function_name from dual


Procedures can't be called within sql statement.Use procedure when u don't need any return values.
Re: use of functions and procedure [message #309276 is a reply to message #309257] Wed, 26 March 2008 23:53 Go to previous message
bookiant
Messages: 7
Registered: March 2008
Junior Member
oh,Thank u very much.
Previous Topic: INSERT STATEMENT with Username included, Can I ?
Next Topic: mutiple cursor
Goto Forum:
  


Current Time: Sun Dec 04 00:19:15 CST 2016

Total time taken to generate the page: 0.04124 seconds