From: | Peter Kroon <plakroon(at)gmail(dot)com> |
---|---|
To: | Gavan Schneider <pg-gts(at)snkmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: ERROR: query has no destination for result data |
Date: | 2012-11-26 19:57:34 |
Message-ID: | CAOh+DO=EwBbVqn-zbxUF+-T=Qy9=D5ysOYXCj7MZW5jP+pXqaw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>Reinterpreting the question and taking the pseudocode semi-literally is
>the following closer to what was asked?
No, I don't want to use/create a function.
Best,
Peter
2012/11/24 Gavan Schneider <pg-gts(at)snkmail(dot)com>
> 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<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
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Kroon | 2012-11-26 20:01:13 | Re: create table in memory |
Previous Message | Peter Kroon | 2012-11-26 19:56:12 | Re: Npgsql |