Robert Fitzpatrick wrote:
> I guess my question is how to replace the following...
>
> FOR searchresults IN SELECT * FROM my_view WHERE <snip> LOOP
>
> With something like this...
>
> FOR searchresults IN SELECT DISTINCT clientname FROM my_view WHERE <snip> LOOP
Build the query as text and use EXECUTE (see manuals for details).
You'll also find quote_ident() and quote_literal() useful - again see
manuals.
You'll need to think through the type implications of picking columns
based on supplied parameters - how do you cope with selecting an integer
this time and a text column next time?
--
Richard Huxton
Archonet Ltd