标签:
CREATE LANGUAGE plpgsql
CREATE or REPLACE function getDatirenshu(w_wjID int)
RETURNS INTEGER
as
'
DECLARE
datiRenshu INTEGER;
BEGIN
select count(id) into datiRenshu
from rfwenjuan_yuanshijieguo
where wenjuanItem_id=w_wjID;
return datiRenshu;
end;' LANGUAGE 'plpgsql';
调用
select getdatirenshu(1);
postgresql 9.2之前的版本 需要CREATE LANGUAGE plpgsql
标签:
原文地址:http://www.cnblogs.com/springday/p/4914945.html