ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: SQL Help -- Escape $ in case expression
Date Tue, 28 Dec 2004 05:40:45 GMT
Yep.  Both # and $ can be escaped by doubling:  ## or $$ respectively.

Clinton


On Mon, 27 Dec 2004 19:39:17 -0800 (PST), Mark Nabours
<manabours@yahoo.com> wrote:
> Hello!
> 
> I have a case expression in my SQL query similar to
> the following:
> 
> sum(case when code = 'tck$' then amount else 0 end) as
> ticketSales
> 
> When the case expression is written like that, I
> receive a
> com.ibatis.common.jdbc.exception.NestedSQLException.
> 
> I changed the case expression to the following and it
> works just fine:
> 
> sum(case when code like 'tck%' then amount else 0 end)
> as ticketSales
> 
> Is there a way to escape the $ in my SQL query so that
> it won't cause a
> com.ibatis.common.jdbc.exception.NestedSQLException?
> 
> Or in general how do you escape characters in your SQL
> query that have special meaning in iBatis (like the
> #)?
> 
> Thanks,
> Mark
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - Easier than ever with enhanced search. Learn more.
> http://info.mail.yahoo.com/mail_250
>

Mime
View raw message