plpgsql question - Mailing list pgsql-general

From Gauthier, Dave
Subject plpgsql question
Date
Msg-id 482E80323A35A54498B8B70FF2B8798004D6215F86@azsmsx504.amr.corp.intel.com
Whole thread Raw
Responses Re: plpgsql question
List 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. 

pgsql-general by date:

Previous
From: Gregg Jaskiewicz
Date:
Subject: Re: Regarding licensing of Postgresql
Next
From: Adrian Klaver
Date:
Subject: Re: plpgsql question