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+DOnwACgwG2p8xQC+vBLr2JAwkNwSJZgTQSvqAPgqfs0_Dg@mail.gmail.com
Whole thread Raw
In response to Re: ERROR: query has no destination for result data  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: ERROR: query has no destination for result data
List pgsql-general
OK, but how do I run some SQL in pgAdmin with declared variables?


2012/11/23 Pavel Stehule <pavel.stehule@gmail.com>
2012/11/23 Peter Kroon <plakroon@gmail.com>:
> So this means it's unable to return data?

yes, it means :(

DO "is" void function, so you cannot to return anything

Regards

Pavel Stehule

>
>
> 2012/11/23 Bartosz Dmytrak <bdmytrak@gmail.com>
>>
>> Hi,
>> according to doc: http://www.postgresql.org/docs/9.2/static/sql-do.html
>> DO returns void:
>> "The code block is treated as though it were the body of a function with
>> no parameters, returning void."
>>
>> Regars
>> Bartek
>>
>> Pozdrawiam,
>> Bartek
>>
>>
>>
>> 2012/11/23 Peter Kroon <plakroon@gmail.com>
>>>
>>> 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
>>>
>>
>

pgsql-general by date:

Previous
From: Euler Taveira
Date:
Subject: Re: [BUGS] Prepared Statement Name Truncation
Next
From: Pavel Stehule
Date:
Subject: Re: ERROR: query has no destination for result data