Solved

Difference between function and procedure.

Posted on 2011-03-14
5
452 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

785 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