Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL refcursor type data #164

Open
iavasiljeva opened this issue Apr 27, 2022 · 0 comments
Open

SQL refcursor type data #164

iavasiljeva opened this issue Apr 27, 2022 · 0 comments

Comments

@iavasiljeva
Copy link

iavasiljeva commented Apr 27, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant