Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOyaK-00057D-Nc for pgsql-sql@arkaria.postgresql.org; Wed, 25 Sep 2013 23:33:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VOyaK-0006ne-64 for pgsql-sql@arkaria.postgresql.org; Wed, 25 Sep 2013 23:33:32 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOyaI-0006n5-0v for pgsql-sql@postgresql.org; Wed, 25 Sep 2013 23:33:30 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VOyaA-0001H6-2I for pgsql-sql@postgresql.org; Wed, 25 Sep 2013 23:33:29 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VOya9-00075s-Nc for pgsql-sql@postgresql.org; Wed, 25 Sep 2013 16:33:21 -0700 Date: Wed, 25 Sep 2013 16:33:21 -0700 (PDT) From: jonathansfl To: pgsql-sql@postgresql.org Message-ID: <008201ceba47$91fbb680$b5f32380$@com> In-Reply-To: <1380151167590-5772408.post@n5.nabble.com> References: <1380150677632-5772407.post@n5.nabble.com> <1380151167590-5772408.post@n5.nabble.com> Subject: Re: postgres subfunction return error MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_214694_28755988.1380152001722" 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 ------=_Part_214694_28755988.1380152001722 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Thank you! What kind of variable would I declare? Is this any form of right? No change to subfunction. In PARENT Function: DECLARE v_outvar1 REFCURSOR; v_outvar2 REFCURSOR; v_outvar3 REFCURSOR; ?And use: SELECT * INTO v_outvar1, v_outvar2, v_outvar3 FROM dev.pr_test_subfunction(SWV_Action); OPEN swv_refcur for SELECT v_outvar1; OPEN swv_refcur2 for SELECT v_outvar2; OPEN swv_refcur3 for SELECT v_outvar3; From: David Johnston [via PostgreSQL] [mailto:ml-node+s1045698n5772408h6@n5.nabble.com] Sent: Wednesday, September 25, 2013 7:19 PM To: jonathansfl Subject: Re: postgres subfunction return error jonathansfl wrote 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 SELECT * FROM dev.pr_test_subfunction(SWV_Action); In pl/pgsql if you do not use an "INTO" clause on a select statement you must replace the "SELECT" with "PERFORM". Failing to do so results in the error you are seeing. In this case your calls to the sub-function do not magically populate the parent function variables. You must manually map the output of the sub-function call query onto the parent variables. David J. _____ If you reply to this email, your message will be added to the discussion below: http://postgresql.1045698.n5.nabble.com/postgres-subfunction-return-error-tp 5772407p5772408.html To unsubscribe from postgres subfunction return error, click here . NAML -- View this message in context: http://postgresql.1045698.n5.nabble.com/postgres-subfunction-return-error-tp5772407p5772409.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. ------=_Part_214694_28755988.1380152001722 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable <= meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">

Thank you!

Wh= at kind of variable would I declare? Is this any form of right?<= /span>

No change to subfunction.<= /span>

In PARENT Function:=

DECLARE v_outvar1 REFCURSOR; v_outvar2 REFC= URSOR; v_outvar3 REFCURSOR;

?And use:

SELECT * INTO = v_outvar1, v_outvar2, v_outvar3 FROM dev.pr_test_subfunction(SWV_Action);

OPEN swv_refcur  =  for SELECT v_outvar1;

OPEN swv_refcur2 for SELECT v_outvar2;

OPEN swv_refcur3 for SELECT v_outvar3;

 

 

From:= Dav= id Johnston [via PostgreSQL] [mailto:[hidden email]]
Sent: Wednesday, September 25, 2013 7:19 = PM
To: jonathansfl
Subject: Re: postgres subfunction re= turn error

 

jo= nathansfl wrote

greetings= . I'm trying to write a function that acts like a switchboard, calling othe= r functions depending on incoming parameters.
I'm getting error: query = has no destination for result data


    SELECT * FROM = dev.pr_test_subfunction(SWV_Action);

In pl/pgsql if you do= not use an "INTO" clause on a select statement you must replace = the "SELECT" with "PERFORM".  Failing to do so res= ults in the error you are seeing.  In this case your calls to the sub-= function do not magically populate the parent function variables.  You= must manually map the output of the sub-function call query onto the paren= t variables.

David J.


If you reply to this email, your message will be added to the= discussion below:

click here= .
NAML

=09 =09 =09

View this message in context: RE: postgre= s subfunction return error
Sent from the PostgreSQL - sql mailing list archive at Nabble.com= .
------=_Part_214694_28755988.1380152001722--