From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Peter Kroon <plakroon(at)gmail(dot)com> |
Cc: | Bartosz Dmytrak <bdmytrak(at)gmail(dot)com>, "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-23 11:13:16 |
Message-ID: | CAFj8pRBLym8dgJYotpsvFuUeMxRyamnqZV3Biu2T2epOitDduA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2012/11/23 Peter Kroon <plakroon(at)gmail(dot)com>:
> OK, but how do I run some SQL in pgAdmin with declared variables?
pgAdmin has own client language similar to T-SQL
http://www.pgadmin.org/docs/dev/pgscript.html - but it is client side
language
if you like server side code, then you have to write table function.
Regards
Pavel
>
>
> 2012/11/23 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
>>
>> 2012/11/23 Peter Kroon <plakroon(at)gmail(dot)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(at)gmail(dot)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(at)gmail(dot)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
>> >>>
>> >>
>> >
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Kroon | 2012-11-23 11:16:18 | Prevent x005F from xml |
Previous Message | Peter Kroon | 2012-11-23 11:01:24 | Re: ERROR: query has no destination for result data |