我试图将 oracle 过程迁移到 postgresql 函数。这是 postgres 中的函数:
CREATE OR REPLACE FUNCTION tibrptsassure.call_reasons(i_start_date date, i_end_date date, i_intnbr character varying, i_intmodnbr character varying, oc_ref_cursor refcursor)
RETURNS refcursor AS
$BODY$
BEGIN
OPEN oc_ref_cursor FOR
SELECT COUNT(1),INTERACTION_NBR,INTERACTION_ID,INTERACTION_MODULE_NBR,CREATED_BY
FROM tibrptsassure.d_tcare_interaction , tibrptsassure.d_calendar d
WHERE INTERACTION_ID = i_intnbr
AND INTERACTION_MODULE_NBR = i_intmodnbr AND INTERACTION_DATE BETWEEN i_start_date AND i_end_date
AND INTERACTION_DATE BETWEEN d.week_start_date AND d.week_end_date
GROUP BY INTERACTION_NBR;
return oc_ref_cursor;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
但是,在执行这个函数时,我没有得到任何输出。收到一条消息:丢弃 1 行的查询结果。
begin;
select tibrptsassure.sampleproc_call('10-Feb-2010','31-Dec-2013','30681','Bypass_IDV','funccursor');
FETCH ALL IN "funccursor" ;
COMMIT;
查询有什么问题?