Re: BUG #14184: Function is running correct but not showing output - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14184: Function is running correct but not showing output
Date
Msg-id 17998.1465831524@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14184: Function is running correct but not showing output  (zzia88@gmail.com)
List pgsql-bugs
zubair alam <zzia88@gmail.com> writes:
> CREATE OR REPLACE FUNCTION FACTORIAL(IN NUM BIGINT,OUT FACT BIGINT) AS $$
> DECLARE
> FACT BIGINT:=1;
>  BEGIN
>   FOR I IN REVERSE 1..NUM LOOP
> FACT:=FACT*I;
> END LOOP;
> END;
> $$ LANGUAGE plpgsql;

> if i am doing FACT BIGINT:=1; the also it giving the output NULL;

Well, the *third* bug in your function is that you're re-declaring
FACT as a local variable, thereby masking the output parameter.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #14184: Function is running correct but not showing output
Next
From: Tom Lane
Date:
Subject: Re: BUG #14185: Indentation error in win32.mak let libpq compile fail on USE_OPENSSL=1 -- fix available