[GENERAL] ERROR: query has no destination for result data

2012-12-02 Thread rahul143
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 - -- View this message in context: http://postgresql.1045698.n5.nabble.com/ERROR-

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-26 Thread Peter Kroon
>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 > On Friday, November 23, 2012 at 21:36, Peter Kroon wrote: > > Hello, >> >> I wish to return t

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-24 Thread Adrian Klaver
On 11/24/2012 12:46 AM, Gavan Schneider wrote: 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...

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-24 Thread Gavan Schneider
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

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Adrian Klaver
On 11/23/2012 03:25 AM, Peter Kroon wrote: Yes, but this means I have to create a function which is something I don't want. I just want to debug some of my code in the related function. So what I want is in pgAdmin declare some vars and run the sql and get the result. The way I handle this is t

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
OK, but how do I run some SQL in pgAdmin with declared variables? 2012/11/23 Pavel Stehule > 2012/11/23 Peter Kroon : > > 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/1

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Craig Ringer
On 11/23/2012 06:36 PM, Peter Kroon wrote: > Hello, > > I wish to return the SELECT statement. > Ho can I achieve this? RETURN QUERY. See http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html --

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Craig Ringer
On 11/23/2012 06:53 PM, Peter Kroon wrote: > When using: > RETURN QUERY( > SELECT 'this is text' > ); > > I get another error: > ERROR: cannot use RETURN QUERY in a non-SETOF function Use a plain SQL function instead of PL/PgSQL, or use `SELECT INTO` and ordinary `RETURN`. -- Craig Ringer

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
Thanks, I'll have a look at this. 2012/11/23 Pavel Stehule > 2012/11/23 Peter Kroon : > > 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 > >

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
Yes, but this means I have to create a function which is something I don't want. I just want to debug some of my code in the related function. So what I want is in pgAdmin declare some vars and run the sql and get the result. 2012/11/23 John R Pierce > On 11/23/12 2:53 AM, Peter Kroon wrote: >

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread John R Pierce
On 11/23/12 2:53 AM, Peter Kroon wrote: I get another error: ERROR: cannot use RETURN QUERY in a non-SETOF function what is your function deined to return? a query returns a set of records, even if that set is 1 record of 1 field (like, select 'some text';) you could declare a record vari

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Pavel Stehule
2012/11/23 Peter Kroon : > 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. Regard

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
When using plain SQL I get this message: ERROR: language "sql" does not support inline code execution When removing the BEGIN+END block statements the message persists. 2012/11/23 Craig Ringer > On 11/23/2012 06:53 PM, Peter Kroon wrote: > > When using: > RETURN QUERY( > SELECT 'this is text

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Pavel Stehule
2012/11/23 Peter Kroon : > 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 >> >> Hi, >> according to doc: http://www.postgresql.org/docs/9.2/static/sql-do.html >> DO retur

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
So this means it's unable to return data? 2012/11/23 Bartosz Dmytrak > 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

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
When using: RETURN QUERY( SELECT 'this is text' ); I get another error: ERROR: cannot use RETURN QUERY in a non-SETOF function 2012/11/23 Craig Ringer > On 11/23/2012 06:36 PM, Peter Kroon wrote: > > Hello, > > I wish to return the SELECT statement. > Ho can I achieve this? > > > RETURN QUE

Re: [GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Bartosz Dmytrak
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 > Hello, > > I wish to return the

[GENERAL] ERROR: query has no destination for result data

2012-11-23 Thread Peter Kroon
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