zubair alam <zzia88(at)gmail(dot)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