agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Hector Menchaca <hm34306@hotmail.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Function with OUT parameter and Return Query
Date: Sat, 4 Oct 2014 23:23:47 -0500
Message-ID: <BAY178-W3149BE50F365836CDC94EAF8A40@phx.gbl> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
All,Struggling tying to get a function that works in Maraidb stored procs...looking to return an OUT Parameter value with Return Query
CREATE FUNCTION sp_AgentServer_Register (_agentserver_name TEXT, _port INTEGER, out _out_agent_server_id INTEGER) RETURNS SETOF AgentServerAS $$BEGIN Select _agent_server_id INTO _out_agent_server_id FROM sp_private_AgentServer_Insert(_agentserver_name, _port);
Update AgentServer SET RegisteredOn = NOW() where AgentServer_ID = _out_agent_server_id;
RETURN QUERY Select * From AgentServer where AgentServer_ID = _out_agent_server_id; END$$ LANGUAGE plpgsql;
In doing this an error is returned :ERROR: function result type must be integer because of OUT parameters
If I change to Integer, then I get an Error From the return query...ERROR: cannot use RETURN QUERY in a non-SETOF function
Is there a way to do this? (I'm assuming no at this point... i hoping there is some flag or something that I can set...)I can do this with MariaDB and SqlServer...
Any thoughts are appreciated.
=
view thread (3+ messages) latest in thread
Message-ID: <BAY178-W3149BE50F365836CDC94EAF8A40@phx.gbl>
Permalink: ../BAY178-W3149BE50F365836CDC94EAF8A40@phx.gbl/
Also on: postgresql.org/message-id/BAY178-W3149BE50F365836CDC94EAF8A40@phx.gbl
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: hm34306@hotmail.com
Subject: Re: Function with OUT parameter and Return Query
In-Reply-To: <BAY178-W3149BE50F365836CDC94EAF8A40@phx.gbl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox