在程序内返回变量

时间:2018-03-26 04:35:39

标签: postgresql variables stored-procedures

可以帮助我吗?

我的查询:

CREATE OR REPLACE FUNCTION "public"."last_seq"()
  RETURNS SETOF "pg_catalog"."record" AS $BODY$
DECLARE lastid_seq varchar;
BEGIN
    SELECT  object_name INTO lastid_seq
        FROM vw_class_information
        WHERE object_type ='SEQUENCE';

    RETURN QUERY EXECUTE
        'SELECT nextval('||lastid_seq||')';     
END 
$BODY$
  LANGUAGE 'plpgsql' VOLATILE COST 100 ROWS 1000;

此结果 vw_class_information

log_activity_dt_id_seq
log_activity_id_seq
log_approval_dt_id_seq
log_approval_id_seq

我想选择结果 vw_class_information 来选择内部程序吗?

0 个答案:

没有答案