开发者

Name query in SQL/SOQL with " ' " as a part of the name

I need to write a soql/sql query which needs to look up for a name that has an apostrophes in it, Like shaquel o'Neil. The problem is that the where clauses dops the Neil part as that is considered as the end of the search criteria.

Any suggestions h开发者_如何学Goow to work this situation?

Thanks!


In most SQL you would quote ' by doubling it to ''. But afaik you have to escape it with an \ in SOQL - so you check for 'shaquel o\'Neil' in your testcase.

I checked it - as I thought, in SOQL you escape with an \. Here is an list of all SOQL-special-chars:

   \n  New line
   \r  Carriage return
   \t  Tab
   \b  Bell
   \f  Form feed
   \"  One double-quote character
   \'  One single-quote character
   \\  Backslash

(Source: Quoted String Escape Sequences )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜