我有一个列,让我们说Col_A
的值为The subscriber already handles the [Price plan][%]. The subscriber cannot handle it again.
注意通配符%
。现在,我传入以下输入参数:The subscriber already handles the [Price plan][MyProduct]. The subscriber cannot handle it again.
我需要执行一个LIKE
语句,该语句将返回相同的行,与我将指定的[Price plan][******]
无关。
我尝试过以下操作,但未找到任何行:
select * from LD_DATA
where UPPER(Col_A) LIKE UPPER('The subscriber already handles the [Price plan][test]. The subscriber cannot handle it again.');
请注意'The subscriber already handles the [Price plan][test]. The subscriber cannot handle it again.'
是我的输入参数变量。
请帮忙吗?
答案 0 :(得分:0)
如果我清楚地理解你的问题
select * from LD_DATA
where UPPER(Col_A) LIKE UPPER('The subscriber already handles the %. The subscriber cannot handle it again.');
答案 1 :(得分:0)
必须切换WHERE
条件才能使输入参数与列值匹配,反之亦然。
所以,而不是where UPPER(Col_A) LIKE UPPER('The subscriber already handles *)
它应该是where UPPER('The subscriber already handles *') LIKE UPPER(Col_A)
答案 2 :(得分:0)
您必须使用[]包围特殊字符(或范围)。
你不需要逃离结束括号。
select * from LD_DATA
where Col_A LIKE 'the subscriber already handles the [[]Price plan][[]%]. the subscriber cannot handle it again.';