From: Virgilio Sanz <vsanz@el-mundo.net>
To: pgsql-sql@postgresql.org
Subject: do queries from strings in pgplsql
Date: Wed, 1 Dec 1999 17:04:23 +0100
Message-ID: <19991201170423.E18860@el-mundo.net> (raw)
Hi list,
I'm just added to the list and I'm not sure whether the following is a
FAQ or not possible. Anyway, here it goes:
Is it possible to execute a query stored into a string?
I mean, something like:
function test(text) as returns opaque as '
declare
v_weekday alias for $1;
s_qry text; rec record;
begin
s_qry = ''select field1,field2, '' || v_weekday || '' from t_diary'';
for rec in exec_sql(s_qry)
loop
-- ^ that is what I'm looking for...
-- [do what is needed]
end loop;
end;
' language 'plpgsql';
Thanks in advance,
Virgilio Sanz
--
Virgilio Sanz vsanz@el-mundo.net virgilio.sanz@el-mundo.es
Diario el Mundo en Internet http://www.el-mundo.es
Email me with "send key pub" on subject to get my public key
"Success covers a multitude of blunders."
-- George Bernard Shaw
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: vsanz@el-mundo.net
Subject: Re: do queries from strings in pgplsql
In-Reply-To: <19991201170423.E18860@el-mundo.net>
References: <19991201170423.E18860@el-mundo.net>
* 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