164 Star 224 Fork 1.2K

openGauss / docs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
调用语句.md 1.11 KB
一键复制 编辑 原始数据 按行查看 历史

调用语句

语法

调用一个语句的语法请参见图1

图 1 call_clause::=

对以上语法格式的解释如下:

  • procedure_name:存储过程名。
  • parameter:存储过程的参数,可以没有或者有多个参数。

示例

--创建存储过程proc_staffs
postgres=# CREATE OR REPLACE PROCEDURE proc_staffs
(
section     NUMBER(6),
salary_sum out NUMBER(8,2),
staffs_count out INTEGER
)
IS
BEGIN
SELECT sum(salary), count(*) INTO salary_sum, staffs_count FROM hr.staffs where section_id = section;
END;
/

--调用存储过程proc_return.
postgres=# CALL proc_staffs(2,8,6);

--清除存储过程
postgres=# DROP PROCEDURE proc_staffs;
1
https://gitee.com/opengauss/docs.git
git@gitee.com:opengauss/docs.git
opengauss
docs
docs
2.0.0

搜索帮助