Re: EXECUTE SELECT INTO... last one!

From: Mario Splivalo <mario(dot)splivalo(at)mobart(dot)hr>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: EXECUTE SELECT INTO... last one!
Date: 2005-09-30 09:21:50
Message-ID: 1128072110.32604.7.camel@ekim
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)splivalo(at)mobart(dot)hr

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Scott cox 2005-09-30 15:38:40 creating postgres tables by passing a string to function
Previous Message Michael Fuhr 2005-09-30 08:34:34 Re: EXECUTE SELECT INTO... last one!