Arce 发表于 2021-7-31 12:27:09

PostgreSQL存储过程

编写存储过程
CREATE OR REPLACE FUNCTION totalRecords ()
RETURNS integer AS $total$
declare
    total integer;
BEGIN
   SELECT count(*) into total FROM EMPLOYEES;
   RETURN total;
END;
$total$ LANGUAGE plpgsql;
执行:
select totalRecords();


文档来源:51CTO技术博客https://blog.51cto.com/u_4048786/3205926
页: [1]
查看完整版本: PostgreSQL存储过程