Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
20 posts
|
Hi Guys, I am trying to use the like operator in my xpl. The Statement goes in this fashion <sql:query> select * from location where location_name like %<sql:param type="xs:string" select="//@countryname"/>% </sql:query> I am expecting the query to be executed as select * from location where location_name like '%France%' but it is getting executed as select * from location where location_name like '%'France'%', thus giving error. how do overcome this? any idea? Thanks in advance!!!! |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
413 posts
|
Hi adev,
> <sql:query> > select * from location where location_name like > %<sql:param type="xs:string" select="//@countryname"/>% > </sql:query> > I am expecting the query to be executed as > select * from location where location_name like '%France%' > > but it is getting executed as select * from location where location_name > like '%'France'%', thus giving error. Maybe you could add the % signs using the XPath concat() function: <sql:query> select * from location where location_name like <sql:param type="xs:string" select="concat('%', //@countryname, '%')" /> </sql:query> But i'm not sure wether this will work. HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
6632 posts
|
>> <sql:query>
>> select * from location where location_name like >> %<sql:param type="xs:string" select="//@countryname"/>% >> </sql:query> > >> I am expecting the query to be executed as select * from >> location where location_name like '%France%' but it is getting >> executed as select * from location where location_name >> like '%'France'%', thus giving error. > > Maybe you could add the % signs using the XPath concat() function: > > <sql:query> select * from location where location_name > like > <sql:param > type="xs:string" > select="concat('%', //@countryname, '%')" > /> > </sql:query> > > But i'm not sure wether this will work. ... [show rest of quote] ... [show rest of quote] I think it should. The original version most likely won't, because
sql:param does not just concatenate the parameter in the SQL query: it sets a JSBC prepared statement parameter. -Erik -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |