Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOyEu-0004C4-Td for pgsql-sql@arkaria.postgresql.org; Wed, 25 Sep 2013 23:11:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VOyEu-000461-AK for pgsql-sql@arkaria.postgresql.org; Wed, 25 Sep 2013 23:11:24 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOyEt-00045u-7V for pgsql-sql@postgresql.org; Wed, 25 Sep 2013 23:11:23 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOyEo-0000vc-Sx for pgsql-sql@postgresql.org; Wed, 25 Sep 2013 23:11:20 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VOyEo-0005sG-0I for pgsql-sql@postgresql.org; Wed, 25 Sep 2013 16:11:18 -0700 Date: Wed, 25 Sep 2013 16:11:17 -0700 (PDT) From: jonathansfl To: pgsql-sql@postgresql.org Message-ID: <1380150677632-5772407.post@n5.nabble.com> Subject: postgres subfunction return error MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 4.5 (++++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org greetings. I'm trying to write a function that acts like a switchboard, calling other functions depending on incoming parameters. I'm getting error: query has no destination for result data Please advise what we're doing wrong. The subfunctions return a series of refcursors in a single table and single row (see pr_test_subfunction). When i run the parent function, i want to see the same results as if i had run the subfunction - the results of the subfunction should pass-thru to the parent calling function. Can this be done? Subfunction: [CODE] CREATE OR REPLACE FUNCTION dev.pr_test_subfunction ( v_action varchar, out swv_refcur refcursor, out swv_refcur2 refcursor, out swv_refcur3 refcursor, out swv_refcur4 refcursor, out swv_refcur5 refcursor ) RETURNS record AS $body$ DECLARE SWV_Action VARCHAR(50) DEFAULT Coalesce(v_Action,''); BEGIN OPEN SWV_RefCur for SELECT 1; OPEN swv_refcur2 for SELECT 2; OPEN swv_refcur3 for SELECT 3; OPEN swv_refcur4 for SELECT 4; OPEN swv_refcur5 for SELECT 5; RETURN; END; $body$ LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER COST 100; [/CODE] Parent Function: [CODE] CREATE OR REPLACE FUNCTION dev.pr_test_parentfunction ( v_action varchar, out swv_refcur refcursor, out swv_refcur2 refcursor, out swv_refcur3 refcursor, out swv_refcur4 refcursor, out swv_refcur5 refcursor ) RETURNS record AS $body$ DECLARE SWV_Action VARCHAR(50) DEFAULT Coalesce(v_Action,'1'); BEGIN IF SWV_Action = '1' THEN SELECT * FROM dev.pr_test_subfunction(SWV_Action); ELSIF SWV_Action = '2' THEN SELECT * FROM dev.pr_test_subfunction(SWV_Action); ELSE OPEN SWV_RefCur for SELECT 1; OPEN swv_refcur2 for SELECT 2; END IF; RETURN; END; $body$ LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER COST 100; [/CODE] -- View this message in context: http://postgresql.1045698.n5.nabble.com/postgres-subfunction-return-error-tp5772407.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql