[postgis-users] Using string variables with PGScript

Bistrais, Bob Bob.Bistrais at maine.gov
Wed Sep 23 14:26:32 PDT 2015


I am having trouble using a variable in a Select statement, using PGScript.  I am trying to define a string variable, then use it in the Select statement.  Something like this:

DECLARE @MYSTRING;
SET @MYSTRING = CAST(@REC[0]['mycode'] AS STRING);   -- at REC was set from a previous select

SELECT * from mytable where myfield = @MYSTRING;

-The variable is not quoted, so the select statement fails.  How do I get the string variable to be enclosed in quotes?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150923/43f67cbd/attachment.html>


More information about the postgis-users mailing list