Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I must do a view in geoserver. I seen some example here: http://docs.geoserver.org/stable/en/user/data/database/sqlview.html. The example show the operator like for parameterizing view. Suppose, now that in WFS request there is a value for a field (named filed1) example &viewparams=value1:a. If i use the operator like

Select filed1, filed2, field3       
From  myTable 
where  field1 like %value1% 

the view return tuples where filed1 is a, aa, aaa, aaaa, aaaaa, etc, but i want tuples where filed1='a'. Can i use the operator =, if yes how write my query?

Select filed1, filed2, field3       
From  myTable 
where  field1 = .......
share|improve this question
Some challenges related to parameters in WMS and standardization is mentioned here: mindland.com/wp/… –  ragnvald Dec 2 '12 at 12:51

1 Answer 1

From the page you link to:

Within the SQL View query, parameter names are delimited by leading and trailing % signs. The parameters can occur anywhere within the query text, including such uses as within SQL string constants, in place of SQL keywords, or representing entire SQL clauses.

So I suspect you can do:

Select filed1, filed2, field3       
From  myTable 
where  field1 = %value1%
share|improve this answer
Ok Iant, thank you :-) now i try –  Riccardo Nov 2 '12 at 11:59
Iant, my query is: Select uri_placeinst, ST_AsText(coord_placeinst) as coord_place_inst From public."NewInfoGeometric" where uri_contesto = %urlcont% and GeometryType(ST_AsText(coord_placeinst)) = %typegeom% and tipofeature=%typefeat% . After click on Refresh for convalidate i have ERROR: syntax error at or near "and" Posizione: 141 –  Riccardo Nov 2 '12 at 13:04
and what do you want me to do about it? look in the log file to see what the actual sql query sent was and use that information to fix your syntax. –  iant Nov 2 '12 at 13:19
because you responded to my post I thought you might like to know that your suggestion is not the right way to parameterize a request. what to do? anything! –  Riccardo Nov 2 '12 at 13:24
No, the parameterization is correct your sql syntax is wrong –  iant Nov 2 '12 at 13:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.