LIKE问题
SELECT U_ID , U_MAILADDRESS , U_SERIAL , U_PASSWD , U_NAME FROM T_USER
WHERE U_NAME LIKE '% #1 % ' AND ROWNUM <101
#1 为条件
当条件为%时,查询出来的是全部数据
怎样才能避免这个问题
------解决方案--------------------可以定义一个转义符 比如 '/ '
SELECT U_ID , U_MAILADDRESS , U_SERIAL , U_PASSWD , U_NAME FROM T_USER
WHERE U_NAME LIKE '% /% % ' AND ROWNUM <101 escape '/ ';
------解决方案--------------------SQL> select * from f_test;
FID
---------------
%kkk
kkk
SQL> select * from f_test where fid like '%kkk ';
FID
---------------
%kkk
kkk
SQL> select * from f_test where fid like '\%kkk ' escape '\ ';
FID
---------------
%kkk
SQL>
------解决方案--------------------是右斜 \,不是左斜 /