user表里有username的字段:
比如有条记录:
userid  username
1       '小明'查一下:
select * from user where username like '小_'; 请问,'小_'为什么只要写一个下划线啊?一个汉字两个字符,应该两个下划线才是啊?

解决方案 »

  1.   

    这里不是字节的意思,你看看下面的就明白SQL> with tb as
      2  (select 1 userid, '小明' username from dual union all
      3  select  2,'小君君' from dual union all
      4  select 3,'小军军' from dual)
      5  select * from tb where username like '小_%'
      6  /
     
        USERID USERNAME
    ---------- --------
             1 小明
             2 小君君
             3 小军军
    SQL> with tb as
      2  (select 1 userid, '小明' username from dual union all
      3  select  2,'小君君' from dual union all
      4  select 3,'小军军' from dual)
      5  select * from tb where username like '小__%'
      6  /
     
        USERID USERNAME
    ---------- --------
             2 小君君
             3 小军军
      

  2.   

    字符的概念跟字节不一样小明  2个字符  4个字节  windows下