select   t.*,   t.rowid   from   user   t   WHERE   t.name   LIKE   'a%c'   有这种查询麽?  查出所有开头为a,结尾为c的数据?  怎么写?

解决方案 »

  1.   

    try it ..
    SQL> select * from test1;
    SNAME
    -------
    abdsfc
    abdsfce
    aacbe
    aabdsfc
    cc
    ac6 rows selected
    SQL> select *
      2    from test1 tt
      3   where sname like 'a%c';SNAME
    -------
    abdsfc
    aabdsfc
    acSQL> 
    SQL> select sname
      2    from test1 tt
      3   where instr(sname,'a',1,1) = 1
      4     and instr(sname,'c',-1,1) = length(sname);SNAME
    -------
    abdsfc
    aabdsfc
    ac
      

  2.   


    楼上说的不错用like速度慢用字符函数会略快
      

  3.   

    不错 LIKE速度慢 这个效率提高很多 MARK