Call Statement

Syntax

Figure 1 shows the syntax diagram for calling a clause.

Figure 1 call_clause::=

The above syntax diagram is explained as follows:

  • procedure_name specifies the name of a stored procedure.
  • parameter specifies the parameters for the stored procedure. You can set no parameter or multiple parameters.

Example

-- Create the stored procedure 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;
/

-- Invoke a stored procedure proc_return:
postgres=# CALL proc_staffs(2,8,6);

-- Delete a stored procedure:
postgres=# DROP PROCEDURE proc_staffs;
Feedback
编组 3备份
    openGauss 2024-11-22 00:52:56
    cancel