更新时间:2024-11-01 GMT+08:00
调用语句
示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
gaussdb=# CREATE TABLE staffs ( section_id INTEGER, salary INTEGER ); CREATE TABLE gaussdb=# INSERT INTO staffs VALUES (30, 10); INSERT 0 1 gaussdb=# INSERT INTO staffs VALUES (30, 20); INSERT 0 1 --创建存储过程proc_staffs gaussdb=# 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 staffs where section_id = section; END; / CREATE PROCEDURE --调用存储过程proc_return. gaussdb=# CALL proc_staffs(2,8,6); salary_sum | staffs_count ------------+-------------- | 0 (1 row) --清除存储过程 gaussdb=# DROP PROCEDURE proc_staffs; DROP PROCEDURE DECLARE DROP TABLE |
父主题: 基本语句