Hi,
I'm trying to assign the row count of a query to a variable in a function
but I'm not having any luck.
Could someone tell me the syntax? I've been looking in the docs and
googling for a long time but just can't find the answer.
I've tried:
CREATE OR REPLACE FUNCTION ret1() RETURNS int4 AS '
BEGIN
declare
var int4;
begin --select var count(*) from T; --select var (count(*)) from T; --select var = count(*) from T; var
=select count(*) from T; return var;
END;
END;
'
LANGUAGE 'plpgsql';