How can I escape square brackets in a LIKE clause?

后端 未结 10 1883
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 14:28

I am trying to filter items with a stored procedure using like. The column is a varchar(15). The items I am trying to filter have square brackets in the name.

For ex

10条回答
  •  北海茫月
    2020-11-22 14:57

    There is a problem in that whilst:

    LIKE 'WC[[]R]S123456' 
    

    and:

    LIKE 'WC\[R]S123456' ESCAPE '\'
    

    Both work for SQL Server but neither work for Oracle.

    It seems that there is no ISO/IEC 9075 way to recognize a pattern involving a left brace.

提交回复
热议问题