Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: need help with simple Function
Hi,
Am Wed, 12 Jan 2005 07:17:41 GMT schrieb Randy Harris <randy_at_SpamFree.com>:
> I'm new to PL/SQL, need help with what should be (I think) a simple
> problem.
> I'm trying to sum the digits in a number, here's what I have so far:
>
> CREATE OR REPLACE FUNCTION Session_Hash
> (sessid IN NUMBER ) RETURN NUMBER
> IS
> dig_sum INTEGER;
You have to initialize with 0: dig_sum INTEGER:=0; Otherwise dig_sum is NULL and every expression with dig_sum as a component will evaluate to NULL.
-- Frank Piron, defrankatkonaddot (leftrotate two)Received on Wed Jan 12 2005 - 01:40:26 CST