pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Virgilio Sanz <vsanz@el-mundo.net>
To: pgsql-sql@postgresql.org
Subject: PL/PgSQL: selects into strings
Date: Thu, 2 Dec 1999 16:16:24 +0100
Message-ID: <19991202161624.D1959@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 there a way to execute a query stored in 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)
--	           ^ this is what I'm looking for...
--		[do what is needed]
	loop
	end loop;
end;
' language 'plpgsql';

Thanks in advance,
Virgilio

-- 
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
 
Kime's Law for the Reward of Meekness:
	Turning the other cheek merely ensures two bruised cheeks.

view thread (2+ messages)  latest in thread

Message-ID: <19991202161624.D1959@el-mundo.net>
Permalink:  ../19991202161624.D1959@el-mundo.net/
Also on:    postgresql.org/message-id/19991202161624.D1959@el-mundo.net

 · 

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 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: PL/PgSQL: selects into strings
  In-Reply-To: <19991202161624.D1959@el-mundo.net>
  References: <19991202161624.D1959@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