select * from Table where substring(3,7)<'2009'
大概是这样的怎么优化这个语句?

解决方案 »

  1.   

    什么意思? oracle里没有substring
      

  2.   

    写法是有问题,因为我只记得个大概,似乎substring(3,7)括号内还有什么东西忘记了 
      

  3.   

    create table test_year(id int primary key,str varchar2(20));create index test_year_idx1 
    on test_year(to_number(substr(str,3,7)))最好转化成整数比较,否则字符比较有可能结果会不同