📜  psql 存储过程 - 返回多个表值 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:24.589000             🧑  作者: Mango

代码示例1
CREATE OR REPLACE FUNCTION get_production_deployment(appId integer)
  RETURNS TABLE(empId INTEGER, empName VARCHAR, designation VARCHAR) AS
$
BEGIN
 RETURN QUERY
 
 SELECT employee.id, employee.name, employee.designation
 FROM employee where employee.id = 
 (SELECT empId FROM prod_movement where prod_movement.appId = appId)

END; $
 
LANGUAGE plpgsql;