pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wieck@debis.com
To: vsanz@el-mundo.net
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] PL/PgSQL: selects into strings
Date: Fri, 3 Dec 1999 11:01:26 +0100 (MET)
Message-ID: <m11tpWo-0003kGC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <19991202161624.D1959@el-mundo.net>

> 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 =3D ''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';

    PL/pgSQL  doesn't  support  it. Could get implemented, in the
    mean time look at PL/Tcl, it can do it already.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #





view thread (2+ messages)

Message-ID: <m11tpWo-0003kGC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m11tpWo-0003kGC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m11tpWo-0003kGC@orion.SAPserv.Hamburg.dsh.de

 · 

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: wieck@debis.com, vsanz@el-mundo.net
  Subject: Re: [SQL] PL/PgSQL: selects into strings
  In-Reply-To: <m11tpWo-0003kGC@orion.SAPserv.Hamburg.dsh.de>
  References: <19991202161624.D1959@el-mundo.net> <m11tpWo-0003kGC@orion.SAPserv.Hamburg.dsh.de>

* 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