Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Martín Marqués
El día 29 de agosto de 2011 16:12, Pavel Stehule escribió: > 2011/8/29 Martín Marqués : >>> >>> refcursors can be dynamic defined >> >> OK, I'm totally lost. How do you define a dynamic cursor? Couldn't >> find anything in the manuals. >> > > DECLARE >    curs1 refcursor; > BEGIN >  OPEN curs1 FOR

Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Pavel Stehule
2011/8/29 Martín Marqués : > El día 29 de agosto de 2011 15:52, Pavel Stehule > escribió: >> 2011/8/29 Martín Marqués : >>> El día 29 de agosto de 2011 15:28, Pavel Stehule >>> escribió: 2011/8/29 Martín Marqués : > Actually, what we are trying to do is return 2 recordsets with the >

Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Martín Marqués
El día 29 de agosto de 2011 15:52, Pavel Stehule escribió: > 2011/8/29 Martín Marqués : >> El día 29 de agosto de 2011 15:28, Pavel Stehule >> escribió: >>> 2011/8/29 Martín Marqués : Actually, what we are trying to do is return 2 recordsets with the same function call (simulate SP from

Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Pavel Stehule
2011/8/29 Martín Marqués : > El día 29 de agosto de 2011 15:28, Pavel Stehule > escribió: >> 2011/8/29 Martín Marqués : >>> Actually, what we are trying to do is return 2 recordsets with the >>> same function call (simulate SP from SQL Server returning 2 >>> recordsets). >>> >>> I found out that I

Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Martín Marqués
El día 29 de agosto de 2011 15:28, Pavel Stehule escribió: > 2011/8/29 Martín Marqués : >> Actually, what we are trying to do is return 2 recordsets with the >> same function call (simulate SP from SQL Server returning 2 >> recordsets). >> >> I found out that I had to do PERFORM * FROM construyecu

Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Pavel Stehule
2011/8/29 Martín Marqués : > Actually, what we are trying to do is return 2 recordsets with the > same function call (simulate SP from SQL Server returning 2 > recordsets). > > I found out that I had to do PERFORM * FROM construyecursordesdequery($1, > query) > which works now, but can't run 2 dif

Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Martín Marqués
Actually, what we are trying to do is return 2 recordsets with the same function call (simulate SP from SQL Server returning 2 recordsets). I found out that I had to do PERFORM * FROM construyecursordesdequery($1, query) which works now, but can't run 2 different queries on the same cursor. I was

Re: [GENERAL] passing cursors from one PL function to another

2011-08-29 Thread Martín Marqués
El día 26 de agosto de 2011 09:15, Merlin Moncure escribió: > 2011/8/26 Martín Marqués : >> El día 26 de agosto de 2011 00:04, Merlin Moncure >> escribió: >>> 2011/8/25 Martín Marqués : CREATE OR REPLACE FUNCTION prueba_cursor(codigo integer, curCursor refcursor)   RETURNS SETOF

Re: [GENERAL] passing cursors from one PL function to another

2011-08-26 Thread Merlin Moncure
2011/8/26 Martín Marqués : > El día 26 de agosto de 2011 00:04, Merlin Moncure > escribió: >> 2011/8/25 Martín Marqués : >>> CREATE OR REPLACE FUNCTION prueba_cursor(codigo integer, curCursor >>> refcursor) >>>   RETURNS SETOF refcursor AS >>> $BODY$ >>> DECLARE >>>       cur alias for $2; >>> B

Re: [GENERAL] passing cursors from one PL function to another

2011-08-26 Thread Martín Marqués
El día 26 de agosto de 2011 00:04, Merlin Moncure escribió: > 2011/8/25 Martín Marqués : >> CREATE OR REPLACE FUNCTION prueba_cursor(codigo integer, curCursor refcursor) >>   RETURNS SETOF refcursor AS >> $BODY$ >> DECLARE >>       cur alias for $2; >> BEGIN >>       PERFORM mpf.ConstruyeCursorDes

Re: [GENERAL] passing cursors from one PL function to another

2011-08-25 Thread Merlin Moncure
2011/8/25 Martín Marqués : > 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; > $

Re: [GENERAL] passing cursors from one PL function to another

2011-08-25 Thread Martín Marqués
Sorry, pressed send. :-( I have, as the functions show below, 2 functions that call one another, passing a cursor (AFAIK). The problem is that it doesn't work, giving errors when executing the last SELECT. Is it posible to pass a cursor from one function to another? El día 25 de agosto de 2011 2

[GENERAL] passing cursors from one PL function to another

2011-08-25 Thread Martín Marqués
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 R