0

Datagrip 无法从游标中读取以下查询:

SELECT public.get_user_summary('ALL');
FETCH ALL FROM ref1;

功能代码:

CREATE OR REPLACE FUNCTION public.get_user_summary(username text)
  RETURNS refcursor AS
$BODY$
DECLARE ref1 refcursor := 'ref1';
BEGIN
    OPEN ref1 FOR
    select * FROM public.user_details where user_name=username;
    RETURN ref1;
END
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

它适用于 pgAdmin 但 datagrip 给出以下错误:

<failed to load>
org.postgresql.util.PSQLException: ERROR: cursor "ref1" does not exist

有解决方案吗?

4

0 回答 0