pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
EXECUTE SELECT INTO... last one!
3+ messages / 2 participants
[nested] [flat]

* EXECUTE SELECT INTO... last one!
@ 2005-09-30 08:00  Mario Splivalo <mario.splivalo@mobart.hr>
  0 siblings, 1 reply; 3+ messages in thread

From: Mario Splivalo @ 2005-09-30 08:00 UTC (permalink / raw)
  To: pgsql-sql

PgSql8.1beta2 gives me this:

ERROR:  EXECUTE of SELECT ... INTO is not implemented yet
CONTEXT:  PL/pgSQL function "_rndbroj" line 5 at execute statement

Shall I forget about this once and for all (and use FOR construct), or
there is a chance that will be 'fixed'?

	Mario
-- 
Mario Splivalo
Mob-Art
mario.splivalo@mobart.hr

"I can do it quick, I can do it cheap, I can do it well. Pick any two."





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: EXECUTE SELECT INTO... last one!
@ 2005-09-30 08:34  Michael Fuhr <mike@fuhr.org>
  parent: Mario Splivalo <mario.splivalo@mobart.hr>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Fuhr @ 2005-09-30 08:34 UTC (permalink / raw)
  To: Mario Splivalo <mario.splivalo@mobart.hr>; +Cc: pgsql-sql

On Fri, Sep 30, 2005 at 10:00:35AM +0200, Mario Splivalo wrote:
> PgSql8.1beta2 gives me this:
> 
> ERROR:  EXECUTE of SELECT ... INTO is not implemented yet
> CONTEXT:  PL/pgSQL function "_rndbroj" line 5 at execute statement

Could you post a simple example of what you're trying to do?  The
following works for me in 8.1beta2 (from CVS):

CREATE FUNCTION mycount(text) RETURNS bigint AS $$
DECLARE
    query  text;
    cnt    bigint;
BEGIN
    query := 'SELECT count(*) FROM ' || quote_ident($1);
    EXECUTE query INTO cnt;
    RETURN cnt;
END;
$$ LANGUAGE plpgsql;

SELECT mycount('pg_class');
 mycount 
---------
     188
(1 row)

-- 
Michael Fuhr



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: EXECUTE SELECT INTO... last one!
@ 2005-09-30 09:21  Mario Splivalo <mario.splivalo@mobart.hr>
  parent: Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Mario Splivalo @ 2005-09-30 09:21 UTC (permalink / raw)
  To: pgsql-sql

On Fri, 2005-09-30 at 02:34 -0600, Michael Fuhr wrote:
> On Fri, Sep 30, 2005 at 10:00:35AM +0200, Mario Splivalo wrote:
> > PgSql8.1beta2 gives me this:
> > 
> > ERROR:  EXECUTE of SELECT ... INTO is not implemented yet
> > CONTEXT:  PL/pgSQL function "_rndbroj" line 5 at execute statement
> 
> Could you post a simple example of what you're trying to do?  The
> following works for me in 8.1beta2 (from CVS):
> 
> CREATE FUNCTION mycount(text) RETURNS bigint AS $$
> DECLARE
>     query  text;
>     cnt    bigint;
> BEGIN
>     query := 'SELECT count(*) FROM ' || quote_ident($1);
>     EXECUTE query INTO cnt;
>     RETURN cnt;
> END;
> $$ LANGUAGE plpgsql;

Yes, it's my fault. I was testing it on pg7.4. On 8.1beta2 works as you
explained. Though it would be realy nice to be able to do 

	var := col FROM tempTable WHERE condition

withouth EXECUTE'ing and stuff.

Sorry for the fuss I might have created.

	Mario
-- 
Mario Splivalo
Mob-Art
mario.splivalo@mobart.hr

"I can do it quick, I can do it cheap, I can do it well. Pick any two."





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-09-30 09:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-30 08:00 EXECUTE SELECT INTO... last one! Mario Splivalo <mario.splivalo@mobart.hr>
2005-09-30 08:34 ` Michael Fuhr <mike@fuhr.org>
2005-09-30 09:21   ` Mario Splivalo <mario.splivalo@mobart.hr>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox