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

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Variable Question

Re: PL/SQL Variable Question

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Thu, 9 Mar 2000 20:16:06 +0100
Message-ID: <952671444.8579.2.pluto.d4ee154e@news.demon.nl>


You may not assume variables are properly initialized automatically. So, yes, if you didn't declare them with a default, you need to 'clear out', if they are going to return anything.

Hth,

Sybrand Bakker, Oracle DBA

Moore <rlmoore_at_purdue.edu> wrote in message news:Pine.SOL.4.10.10003091350550.18777-100000_at_herald.cc.purdue.edu...
> Ladies and Gentlemen,
>
> Do I need to "clear out" variables at the end of a function (i.e. below)?
>
> If so, how? I have looked in a few places without any luck.
>
> TIA
>
> CREATE OR REPLACE
> FUNCTION AR_Balance (cust_code IN NUMBER, prem_code IN VARCHAR2) RETURN
> NUMBER IS
> nbal NUMBER(10,2);
> BEGIN
> SELECT SUM(NVL(uabopen_balance, 0))
> INTO nbal
> FROM uimsmgr.uabopen
> WHERE uabopen_cust_code = cust_code
> AND uabopen_prem_code = prem_code;
>
> RETURN(nbal);
>
> EXCEPTION
> WHEN NO_DATA_FOUND THEN
> RETURN(0);
>
> \* Should I null nbal here?
> END;
>
Received on Thu Mar 09 2000 - 13:16:06 CST

Original text of this message

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