Solved

Difference between function and procedure.

Posted on 2011-03-14
5
454 Views
Last Modified: 2012-05-11
When it is required to use a function and when we need to use procedure?
what really is the difference in terms of application or usage?
0
Comment
Question by:sakthikumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:mayankagarwal
ID: 35125982
0
 
LVL 5

Expert Comment

by:mayankagarwal
ID: 35125990
0
 
LVL 2

Expert Comment

by:swadhinray
ID: 35125991
You can go though the OTN site and can get the details else just do a search internet you will find huge resources available like what I did:

http://www.google.co.in/#hl=en&biw=1280&bih=785&q=Difference+between+function+and+procedure+in+oracle&aq=f&aqi=g10&aql=&oq=&fp=df1008b532a3f545

0
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 500 total points
ID: 35125994
both are subroutines or code modules.

But function can return a single value at any time, so that means it can be used in expressions etc to check the returned value directly. also it can be called from sql queries.

But procedure can return any values depending on how  you code it. if you code it to return a pl/sql array then you are returning many values. If you code it to return a single out variable, then it means you are just returning one value. procedures need not always have to return values. I mean your procedure can have code without OUT variables and in this case it just means it can execute the code inside it but it cannot return some data from it in the form of variables.

Thanks
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 35136255
Good and thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question