0

我有一个使用 AWS SCT 从 SQL Server 转换为 PostgreSQL 的存储过程。这是我无法调用的程序代码。

CREATE OR REPLACE FUNCTION test.sp_getnthhightesttinyintsp(IN par_nthrow_par numeric, OUT p_refcur refcursor)
  RETURNS refcursor AS
$BODY$
DECLARE
    var_NthRow NUMERIC(10, 0) DEFAULT par_NthRow_par;
BEGIN
    OPEN p_refcur FOR
    SELECT
        tinyint_dt
        FROM test.table_1 AS e1
        WHERE var_NthRow - 1 = (SELECT
            COUNT(DISTINCT tinyint_dt)
            FROM test.table_1 AS e2
            WHERE e2.tinyint_dt > e1.tinyint_dt)
        LIMIT 1;
RETURN;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION test.sp_getnthhightesttinyintsp(numeric)
  OWNER TO postgres;
4

0 回答 0