数据库
首页 > 数据库> > pgsql存储函数简单使用

pgsql存储函数简单使用

作者:互联网

CREATE OR REPLACE FUNCTION "public"."generate_road_list_id_to_jcpddas"("road_code_param" varchar)
  RETURNS "pg_catalog"."int4" AS $BODY$
declare returnvalue integer;
BEGIN
  SELECT count(1) from road_lst rl left join road_jcpd_record rjr on rl.road_code = rjr.road_code where rl.road_code =road_code_param into returnvalue;
  UPDATE road_jcpd_record set road_lst_id = (SELECT id from road_lst where road_code = road_code_param limit 1) where road_code = road_code_param ;
  return returnvalue;
END$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100

搜索

复制

标签:存储,code,函数,param,pgsql,lst,returnvalue,id,road
来源: https://www.cnblogs.com/myself1012/p/16599769.html