Re: postgres subfunction return error

From: jonathansfl <jonathanbrinkman(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: postgres subfunction return error
Date: 2013-09-25 23:33:21
Message-ID: 008201ceba47$91fbb680$b5f32380$@com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)n5(dot)nabble(dot)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
<http://postgresql.1045698.n5.nabble.com/template/NamlServlet.jtp?macro=unsu
bscribe_by_code&node=5772407&code=am9uYXRoYW5icmlua21hbkB5YWhvby5jb218NTc3Mj
QwN3wtNDQ0Mzc4MjI4> .

<http://postgresql.1045698.n5.nabble.com/template/NamlServlet.jtp?macro=macr
o_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.B
asicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.templ
ate.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-insta
nt_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message jonathansfl 2013-09-27 14:57:16 Re: postgres subfunction return error
Previous Message David Johnston 2013-09-25 23:19:27 Re: postgres subfunction return error