Re: how to return results from code block

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: how to return results from code block
Дата
Msg-id 4FEF0AD3.60109@gmail.com
обсуждение исходный текст
Ответ на how to return results from code block  ("Andrus" <kobruleht2@hot.ee>)
Ответы Re: how to return results from code block  (David Johnston <polobo@yahoo.com>)
Список pgsql-general
On 06/30/2012 03:17 AM, Andrus wrote:
> How to return single row or results from code block executed using
> ADO.NET ExecuteQuery() method.
> I tried
> DO $$
> declare
>    i integer :=0;
> begin
> select i+1 as res1, i+2 as res2;
> END$$;
> but got error:
> ERROR: query has no destination for result data
> How to return single row result from code pgsql  code block ?
> Andrus.

Besides what Pavel said about not returning a result there is another
issue with the above. It did not specify a language. I cleaned the
function up a bit:

DO $$
declare
   i integer :=0;
   rec record;

begin
select  i+1 as res1, i+2 as res2 into rec;
raise notice 'The results are %s,%s', rec.res1,rec.res2;
END$$ LANGUAGE plpgsql;

This does not actually return anything but does raise a notice so you
see something happened.

--
Adrian Klaver
adrian.klaver@gmail.com



В списке pgsql-general по дате отправления:

Предыдущее
От: "Andrus"
Дата:
Сообщение: How to insert record only if primary key does not exist
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: how to return results from code block