Search Postgresql Archives

passing cursors from one PL function to another

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



CREATE OR REPLACE FUNCTION prueba_cursor(codigo integer, curCursor refcursor)
   RETURNS SETOF refcursor AS
$BODY$
DECLARE
       cur alias for $2;
BEGIN
       PERFORM mpf.ConstruyeCursorDesdeQuery('cur' ,'SELECT * from
tab1 WHERE field < 11000');
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100
ROWS 1000;

CREATE OR REPLACE FUNCTION construyecursordesdequery(refcursor, query text)
   RETURNS SETOF refcursor AS
$BODY$
BEGIN
   OPEN $1 FOR Select * from tab1 where field < 11000;
   RAISE NOTICE '%', $1;
   RETURN NEXT $1;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100
ROWS 1000;

begin;
select * from prueba_cursor4(1, 'h');
end;



-- 
Martín Marqués
select 'martin.marques' || '@' || 'gmail.com'
DBA, Programador, Administrador

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux