From: | Gavan Schneider <pg-gts(at)snkmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: ERROR: query has no destination for result data |
Date: | 2012-11-24 08:46:16 |
Message-ID: | 12020-1353746777-520266@sneakemail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Friday, November 23, 2012 at 21:36, Peter Kroon wrote:
>Hello,
>
>I wish to return the SELECT statement.
>Ho can I achieve this?
>
DO $$
DECLARE v_some_id int=14;
BEGIN
/*
more queries here...
*/
SELECT 'this is text';
END
$$ LANGUAGE plpgsql;
>
>Best,
>Peter Kroon
>
Reinterpreting the question and taking the pseudocode
semi-literally is
the following closer to what was asked?
ref. 39.2. Structure of PL/pgSQL
<http://www.postgresql.org/docs/9.2/static/plpgsql-structure.html>
pendari=> CREATE FUNCTION somefunc() RETURNS text AS $$
pendari$>
pendari$> DECLARE
pendari$> v_some_id int=14;
pendari$> BEGIN
pendari$> /*
pendari$> more queries here...
pendari$> */
pendari$> RETURN 'this is text'::text;
pendari$> END;
pendari$> $$ LANGUAGE plpgsql;
CREATE FUNCTION
pendari=> select somefunc();
somefunc
--------------
this is text
(1 row)
pendari=>
Regards
Gavan
From | Date | Subject | |
---|---|---|---|
Next Message | Rafal Pietrak | 2012-11-24 09:15:40 | sefety of passwords for web-service applications |
Previous Message | Edson Richter | 2012-11-24 01:56:56 | Re: Revoke "drop database" even for superusers? |