pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Mario Splivalo <mario.splivalo@mobart.hr>
Cc: pgsql-sql@postgresql.org
Subject: Re: EXECUTE SELECT INTO... last one!
Date: Fri, 30 Sep 2005 02:34:34 -0600
Message-ID: <20050930083434.GA86067@winnie.fuhr.org> (raw)
In-Reply-To: <1128067235.32604.3.camel@ekim>
References: <1128067235.32604.3.camel@ekim>

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



view thread (3+ messages)  latest in thread

Message-ID: <20050930083434.GA86067@winnie.fuhr.org>
Permalink:  ../20050930083434.GA86067@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050930083434.GA86067@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, mario.splivalo@mobart.hr
  Subject: Re: EXECUTE SELECT INTO... last one!
  In-Reply-To: <20050930083434.GA86067@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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