Skip site navigation (1) Skip section navigation (2)

Fwd: Re: question - plpgsql and query on table given by variable

From: " Jaromír Kamler" <kamler(at)centrum(dot)cz>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Fwd: Re: question - plpgsql and query on table given by variable
Date: 2005-08-29 09:13:15
Message-ID: 200508291113.4458@centrum.cz (view raw or flat)
Thread:
Lists: pgsql-novice
Thank you for your reply. It helped me, but I need know some results. So I tryed use SELECT INTO in EXECUTE string and it do not work. Also I try this:

CREATE OR REPLACE FUNCTION n(varchar) RETURNS varchar AS $$
DECLARE
 a varchar;
BEGIN
 a := $1;
 PERFORM * FROM b;
 EXECUTE 'PERFORM AsText(the_geom) FROM ' || a || ';';
 IF FOUND THEN 
 RETURN 'yes'; 
 END IF; 
 IF FOUND THEN 
 RETURN 'no';
 END IF;
 RETURN 'I do not know';
END;
$$ LANGUAGE plpgsql;

Error:
SELECT n('b');
ERROR: syntax error at or near "PERFORM" at character 1
QUERY: PERFORM AsText(the_geom) FROM b;
CONTEXT: PL/pgSQL function "n" line 7 at execute statement
LINE 1: PERFORM AsText(the_geom) FROM b;
 
When I use PPERFORM in normal way, it works. How I can reach some results from the query executed by EXECUTE?

Thanks for your help


Responses

pgsql-novice by date

Next:From: Oren MazorDate: 2005-08-29 18:43:30
Subject: array vs flat tables performance
Previous:From: Michael FuhrDate: 2005-08-28 21:55:45
Subject: Re: question - plpgsql and query on table given by variable

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group