Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie Question: Procedures vs. Functions
The most obvious different is that function will return a value while
procedure don't have to.
Roar Pettersen wrote in message ...
>"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 - 22:06:14 CDT
![]() |
![]() |