Hola a todos.

soy nuevo usando postgres y tengo el siguiente código:

create or replace function models_data_rs() 
        returns setof refcursor as $$
        declare
                ref refcursor;
        begin
                open ref for select * into r from models;
        end;
$$ language plpgsql;

hasta ahí va todo bien, el tema es que desde el mismo postgres cuando hago

select models_data_rs(); 

postgres me da el siguiente error:

ERROR:  cannot open SELECT query as cursor
CONTEXT:  PL/pgSQL function models_data_rs() line 5 at OPEN

********** Error **********

ERROR: cannot open SELECT query as cursor
SQL state: 42P11
Context: PL/pgSQL function models_data_rs() line 5 at OPEN

cómo resuelvo el problema ??

saludos a todos


=============================================
"El tamaño de tus logros depende del tamaño de tus metas." 
C++ and Qt Senior Developer
Lic. Computer Science
Buenos Aires, Argentina

Responder a