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: functions vs procedures

Re: functions vs procedures

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Thu, 21 Feb 2002 11:17:35 +0300
Message-ID: <a52a8k$373$1@babylon.agtel.net>


Guess nobody noticed that the guy writes a web application. :) If he does it with OWA/mod_plsql then he can't use either functions or procedures with out parameters as they are not callable from the web gateway. He can of course call such procedures/functions from a procedure that gets called from the gateway.

As of error trapping - exceptions and nothing but exceptions. Whenever there's something wrong - throw an exception describing your problem. Catch it in caller proc, rollback and process it the way you need (don't rollback in the called proc before throwing the exception - Oracle can throw some of its own there and you will not rollback then). Exception handling is the most useful thing invented in programming since objects :) PL/SQL exceptions lack finally clause, but otherwise are pretty identical to classic try/catch blocks (only they are called begin/exception/end :) )

--
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Jim Kennedy" <kennedy-family_at_attbi.com> wrote in message
news:hKZc8.4935$Iw.6764_at_rwcrnsc51.ops.asp.att.net...

>
> "Mark & Kristi Wagoner" <mwagoner_at_iac.net> wrote in message
> news:a51ci7$29pp$1_at_genma.iac.net...
> > > Is there a way to insert records in a function?
> >
> > Yes. Functions can do the same operations as a procedure. They just have
> a
> > return value.
> >
> While you can do that it is not a good programming practice. This is called
> having a function with side effects.
> That is I call a function - expecting just a return - and it gives me a
> return and does something else. This is why we have procedures. Use out
> parameters for what you want to do.
> Jim
> > > I want to use functions because i can fetch the error messages then.
> >
> > Depending on what you are doing, you may want to look into exceptions.
> Your
> > function (or procedure) can raise an exception, which the caller can trap
> > and get the message.
> >
> > > How can I combine functions and procedures????
> >
> > You can also have the function call the procedure, if it helps.
> >
> > >
> > > Thank you already,
> > >
> > > Julian Kooiker
> > >
> > >
> >
> >
>
>
Received on Thu Feb 21 2002 - 02:17:35 CST

Original text of this message

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