Joseph Syjuco <[EMAIL PROTECTED]> writes:
> i want to put my count() result in a plpgsql declared integer variable
> declare f_count_var integer;
> begin
>       select into f_count_var count(empno) from employee
> end;
> tried this one but it doesnt work

Works for me:

regression=# create function foo() returns int as '
regression'# declare f_count_var integer;
regression'# begin
regression'# select into f_count_var count(unique1) from tenk1;
regression'# return f_count_var;
regression'# end' language plpgsql;
CREATE FUNCTION
regression=# select foo();
  foo
-------
 10000
(1 row)


What PG version are you using?

                        regards, tom lane



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


Reply via email to