Re: [GENERAL] Dynamic SQL in Function

2009-04-23 Thread Martin Gainty
_ Rediscover Hotmail®: Get e-mail storage that grows with you. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Storage2_042009 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make c

Re: [GENERAL] Dynamic SQL in Function

2009-04-23 Thread Merlin Moncure
On Thu, Apr 23, 2009 at 11:36 AM, wrote: >> On Wed, Apr 22, 2009 at 12:29 PM,   wrote: >>> If I have built a dynamic sql statement in a function, how do i return >>> it >>> as a ref cursor? >> >> CREATE FUNCTION reffunc(_ref) RETURNS refcursor AS >> $$ >> BEGIN >>     OPEN _ref FOR execute 'SELEC

Re: [GENERAL] Dynamic SQL in Function

2009-04-23 Thread rwade
Is this possible without having to pass in the _ref parameter? Thanks Ryan > On Wed, Apr 22, 2009 at 12:29 PM, wrote: >> If I have built a dynamic sql statement in a function, how do i return >> it >> as a ref cursor? > > CREATE FUNCTION reffunc(_ref) RETURNS refcursor AS > $$ > BEGIN > OP

Re: [GENERAL] Dynamic SQL in Function

2009-04-22 Thread Merlin Moncure
n Wed, Apr 22, 2009 at 2:54 PM, Merlin Moncure wrote: > On Wed, Apr 22, 2009 at 12:29 PM,   wrote: >> If I have built a dynamic sql statement in a function, how do i return it >> as a ref cursor? > > CREATE FUNCTION reffunc(_ref) RETURNS refcursor AS oops CREATE FUNCTION reffunc(_ref refcursor)

Re: [GENERAL] Dynamic SQL in Function

2009-04-22 Thread Merlin Moncure
On Wed, Apr 22, 2009 at 12:29 PM, wrote: > If I have built a dynamic sql statement in a function, how do i return it > as a ref cursor? CREATE FUNCTION reffunc(_ref) RETURNS refcursor AS $$ BEGIN OPEN _ref FOR execute 'SELECT * from foo'; RETURN _ref; END; $$ LANGUAGE plpgsql; BEGIN; SE

[GENERAL] Dynamic SQL in Function

2009-04-22 Thread rwade
If I have built a dynamic sql statement in a function, how do i return it as a ref cursor? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general