Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie Question: Procedures vs. Functions

Re: Newbie Question: Procedures vs. Functions

From: Roar Pettersen <roarp_at_bigfoot.com>
Date: 29 Jul 1998 11:01:12 +0200
Message-ID: <u7m0x2fqf.fsf@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 - 04:01:12 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US