MYSQL与ORACLE % 与 _ LIKE模糊查询

-- 查询的数据是全部
 
select AAA from where a like '%_%';
 
select AAA from where a like '%%%';
-- 可以查询正确的数据
--MYSQL
select AAA from where a like '%\_%';
 
select AAA from where a like '%\%%';
 
--ORACLE
select AAA from where a like '%\_%' escape '\';
 
select AAA from where a like '%\%%' escape '\';
// js转换数据
let aaa = '_111%222';
aaa.replace(/_/g,'\\_').replace(/%/g,'\\%');
console.log(aaa)
// \_111\%222

你可能感兴趣的:(mysql,oracle,数据库)