转义字符%解决方案
转义字符%
sprintf(SQL, select * from jgxx where jgbm like '%s%%', jgbm) 假如机构编码为'100', 这样会变成select * from jgxx where jgbm like '100_%', 多了个'_', 原本我想要100%,这种怎么解决,还有就是,如果是2%%,就不会出现这种情况,直接就回变成2%,是较为正常的,这是怎么回事儿呢
------解决方案--------------------
sprintf(SQL, select * from jgxx where jgbm like '%s%%', jgbm) 假如机构编码为'100', 这样会变成select * from jgxx where jgbm like '100_%', 多了个'_', 原本我想要100%,这种怎么解决,还有就是,如果是2%%,就不会出现这种情况,直接就回变成2%,是较为正常的,这是怎么回事儿呢
------解决方案--------------------
- SQL code
with t as ( select '123%_323' a from dual union all select '1231%%%' a from dual union all select '12312312' from dual ) select t.* from t where t.a like '%\_%' escape('\') or t.a like '%\%%' escape('\')
------解决方案--------------------
select * from jgxx where jgbm like '%s\%%'escape('\')