Re: ERROR: query has no destination for result data

Поиск
Список
Период
Сортировка
От Peter Kroon
Тема Re: ERROR: query has no destination for result data
Дата
Msg-id CAOh+DO=EwBbVqn-zbxUF+-T=Qy9=D5ysOYXCj7MZW5jP+pXqaw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ERROR: query has no destination for result data  (Gavan Schneider <pg-gts@snkmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Peter Kroon
Дата:
Сообщение: Re: Npgsql
Следующее
От: Peter Kroon
Дата:
Сообщение: Re: create table in memory