plpgsql question

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql question
Date: 2011-12-05 14:59:32
Message-ID: 482E80323A35A54498B8B70FF2B8798004D6215F86@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

v8.3.4 on linux

Is there a way to set the query used in a "for rec in (query) loop -> end loop" be a variable? Example

if (foo = 'whatever')
then
sqlstmt := "select x,y,z ...";
else
sqlstmt := "select a,b,c ...";
end if ;

for therec in
sqlstmt
loop
...
end loop;

Thanks in Advance for any help.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-12-05 15:11:44 Re: plpgsql question
Previous Message Gregg Jaskiewicz 2011-12-05 14:59:08 Re: Regarding licensing of Postgresql