Re: this is probably a stupid question...

From: Jurij Modic <jmodic_at_src.si>
Date: Sat, 09 Jan 1999 00:14:22 GMT
Message-ID: <36969d5f.3266252_at_news.siol.net>


On Fri, 8 Jan 1999 13:46:57 -0500, "Douglas Whitacre" <whitacre_at_imake.com> wrote:

>From my point of view, the only difference is that programming "purists"
>want to use functions as a means to assign a single value to something. ex.
>
>x number
>x = funx(parm1, parm2);
>
>The function, funx returns a number
>
>Procedures just run code. Now, you can define parameters as IN OUT and
>assign values that way as well, but the assignment is a whole lot clearer if
>you use a function.
>
>procx(x, parm1, parm2);
>
>where procedure procx uses first parm as IN OUT, and other two as just IN.
>As you can see from the two examples, if you are debugging code, the
>assignment statement is easier to recognize that the variable x is assigned
>a value. You would have to know the definition of procx to know which of
>the parm Is IN OUT, and further, you would have to understand the code to
>determine if ANY of the parameters get assigned inside the procedure.
>
>Both functions and procedures can call other functions and procedures. It's
>just a matter of taste and clarity (IMO).
>
>I hope this makes sense.

It is not just a matter of taste - there is one big difference between functions and procedures: as funtions actualy return values (not just pass the result as an OUT parameter), they can be called from the SQL statements while procedures can't.

Regards,
Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Sat Jan 09 1999 - 01:14:22 CET

Original text of this message