Re: dynamic SQL - variable substitution in plpgsql

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: km(at)mrna(dot)tn(dot)nic(dot)in
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: dynamic SQL - variable substitution in plpgsql
Date: 2006-12-06 20:33:37
Message-ID: 45772921.7050802@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

km wrote:
> Hi all,
>
> i could not do variable substitution in plpgsql procedure.
> The variable names are taken as it is but not substituted in the SQL query.
> what could be the problem ?
>
>
> FOR result IN "SELECT x,y,z FROM mydata WHERE x = a AND y < b AND z > c" LOOP
> RETURN NEXT result;
>
I don't think you need the quotes around your select statement.

Later,

--
Tony Caduto
AM Software Design
http://www.amsoftwaredesign.com
Home of PG Lightning Admin for Postgresql
Your best bet for Postgresql Administration

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Curtis Braly 2006-12-06 20:48:11 Problems connecting to server
Previous Message km 2006-12-06 20:23:46 dynamic SQL - variable substitution in plpgsql