I'm having some problems with executing functions that takes and returns 
postgres *refcursor* in jOOQ. I have no idea how to approach with 
instantiation the ref, which is *Result<Record>* and how to loop through 
the records I should get from the function I want to execute.

Let's say I have a following function in postgres (postgres 9.5):

create or replace function foo_cursor(name character varying, ref refcursor)
returns refcursor
as $func$
begin
  open ref for
    select id, first_name, last_name
    from students
    where first_name = name;
  return ref;
end
$func$ 
language plpgsql;

And in postgres I'm executing in like that:

begin;
select foo_cursor('Konrad', 'my_cursor');
fetch all in "my_cursor";
commit;

The function has to stay the same - it returns *refcursor* and takes 
*refcursor*.

And I want to execute it in jOOQ:
Routines.fooCursor(configuration, "Konrad", ____);
But I don't know what to put inside the ____, which takes Result<Record>. I 
tried something like:
Result<Record> records = DSL.using(configuration).newResult();
but it also didn't work.

Also, I asked the same question on stack overflow 
(https://stackoverflow.com/questions/50716813/jooq-execute-postgres-user-defined-function-with-refcursor)

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to