Re: [SQL] PL/PgSQL: selects into strings

From: wieck(at)debis(dot)com (Jan Wieck)
To: vsanz(at)el-mundo(dot)net
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] PL/PgSQL: selects into strings
Date: 1999-12-03 10:01:26
Message-ID: m11tpWo-0003kGC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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(at)debis(dot)com (Jan Wieck) #

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Karel Zak - Zakkr 1999-12-03 12:23:17 Datetime operators (was: Re: [SQL] Another Date question)
Previous Message Stoyan Genov 1999-12-03 08:32:38 Re: [SQL] Another Date question