assign count() result to a declared variable in plpgsql

From: Joseph Syjuco <joseph(at)asti(dot)dost(dot)gov(dot)ph>
To: postgres <pgsql-sql(at)postgresql(dot)org>
Subject: assign count() result to a declared variable in plpgsql
Date: 2002-06-24 15:25:30
Message-ID: 1024932336.15861.8.camel@Askr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-06-24 15:39:25 Re: variance aggregate function incorrect? Reference Materials reg create aggregate
Previous Message Marcos Garcia 2002-06-24 13:58:41 Slow SELECT with distinct, in a TIMESTAMP type column