get diagnostics cnt := row_count;
现在有两个表tab1和tab2,两个表的格式相同,tab1中有1000条数据,tab2中0条数据
创建测试功能函数
create or replace function test_fun()
return integer as
$body$
declare
rowcnt integer;
begin
insert into tab2 select * from tab1;
get diagnostics rowcnt := row_count;
return rowcnt;
end;
$body$
LANGUAGE plpgsql VOLATILE;
ALTER FUNCTION test_fun()
OWNER TO gpadmin;
执行
select test_fun()
返回结果1000