cuba-platform / yarg

Yet Another Report Generator - CUBA Platform reporting engine

Home Page:https://www.cuba-platform.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL refcursor type data

iavasiljeva opened this issue · comments

Hi,

Is there any ability to work with SQL refcursor type?

e.g. we have function returning refcursor with data we need to insert into the template:
select Report0302.cCardStaff(idp, dpdate)

CREATE OR REPLACE FUNCTION Report0302.cCardStaff(idp numeric, dpdate timestamp without time zone)
 RETURNS refcursor
 LANGUAGE plpgsql
AS $function$
declare
  p_cursor  refcursor;

begin
 open p_cursor for 
  select AllRep.*
    from AllRep
        where id = idp and dpdate between dbegin and dend
        order by sLevel, nLevelOrder;
   return p_cursor;      
                            
end;
$function$
;

now it results into the error
ОШИБКА: курсор "<unnamed portal 1>" не существует Query: select Report0302.cCardStaff(?::numeric,sysdate()) Parameters: [1.0]

It is a simple example, in reality we have difficult logic with dynamically changing querys, so just taking select-part to insert into the reporting tool is not an option.