Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie Question: Procedures vs. Functions
Functions can and do change data, only difference is it can return only a
single value where as procedures can output/return several values.
Any number of paramters can be passed to both functions and procedures.
Good luck !!!
suresh.bhat_at_mitchell-energy.com
Roar Pettersen <roarp_at_bigfoot.com> wrote in article
<u7m0x2fqf.fsf_at_bigfoot.com>...
> "Scott C." <sdcairns_at_mindspring.com> writes:
> > What's the difference between a PROCEDURE and a FUNCTION? Where would
I use
> > one versus the other?
>
> The way I see it, functions are pl/sql-programs that don't actually
> change data, but rather return a specific value. They are good to
> use in selectstatements, for instance
>
> 'select name, myfunction(salary) from emp;'
>
> where 'myfunction' might give you the salary divided by the age
> of the person or just about anything that you've put into the function...
>
> Procedures are typically used to make changes to data in the database,
> like if you'd like a job to run each night to update an aggregate-table
> of a bigger table or something. (or they could be triggered by certain
> events in the database) Procedures don't return values.
>
> PS: Other, more experienced, pl-sql-programmers could probably give a
> better definition than this.
> --
> Roar Pettersen
> roarp_at_bigfoot.com
> http://www.link.no/roar/
>
Received on Wed Jul 29 1998 - 12:42:46 CDT
![]() |
![]() |