Re: ERROR: query has no destination for result data - Mailing list pgsql-general

From Peter Kroon
Subject Re: ERROR: query has no destination for result data
Date
Msg-id CAOh+DO=EwBbVqn-zbxUF+-T=Qy9=D5ysOYXCj7MZW5jP+pXqaw@mail.gmail.com
Whole thread Raw
In response to Re: ERROR: query has no destination for result data  (Gavan Schneider <pg-gts@snkmail.com>)
List 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@snkmail.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>

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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Peter Kroon
Date:
Subject: Re: Npgsql
Next
From: Peter Kroon
Date:
Subject: Re: create table in memory