Re: BUG #14184: Function is running correct but not showing output

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: zzia88(at)gmail(dot)com
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14184: Function is running correct but not showing output
Date: 2016-06-13 15:03:54
Message-ID: CACjxUsMnaCtqyrWN=-zx=Xm6Yj9cZ=7H0XC9_PGY5RRGWFJ7ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jun 13, 2016 at 8:40 AM, <zzia88(at)gmail(dot)com> wrote:

> -----<<<<<<My function Coding>>>>----
> CREATE OR REPLACE FUNCTION FACTORIAL(IN NUM BIGINT,OUT FACT BIGINT) AS $$
> DECLARE
> FACT BIGINT;
> BEGIN
> FOR I IN REVERSE 1..NUM LOOP
> FACT:=FACT*I;
> END LOOP;
> END;
> $$ LANGUAGE plpgsql;
> -----<<<<<<<<<<<<>>>>>>>>>>>>>-----
> SELECT* FROM FACTORIAL(5);
>
> IT SHOWING NULL VALUE...

FACT is NULL on declaration. NULL (unknown) multiplied by anything is NULL.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-06-13 15:05:57 Re: BUG #14184: Function is running correct but not showing output
Previous Message Jeff Janes 2016-06-13 14:22:51 Re: PostgreSQL (9.3 and 9.6) eats all memory when using many tables