select * from V where std_date > to_date('07-10-9','yyyy-mm-dd')
V是一个视图,其中有个表字段std_date 为date类型。运行时提示说“文字与格式字符串不匹配”,不知道是啥毛病???

解决方案 »

  1.   

    to_date( '07-10-9 ', 'yyyy-mm-dd ') 
    改成to_date( '2007-10-9 ', 'yyyy-mm-dd ') 
      

  2.   

    或者:to_date(  '2007-10-09  ',  'yyyy-mm-dd  ')  
      

  3.   

    还有个问提:select * from V where std_date  > to_date( '07-10-9 ', 'yyyy-mm-dd ') 
    我这样写后怎么std_date=2007-05-16的时间都出来了呀,这跟没比较没啥区别呀,请问这是为什么?????
      

  4.   

    to_date(  '07-10-9  ',  'yyyy-mm-dd  ') 的结果是“0007/10/09” 
      

  5.   

    select * from V where std_date   > to_date('2007-10-9','yyyy-mm-dd') 
    这样就没问题
    前面的格式同后面的格式相同就行了
    你也可以这样么
    select * from V where std_date   > to_date('2007/10/9','yyyy/mm/dd') 
      

  6.   

    还有个问提:select * from V where std_date > to_date(  '07-10-9  ',  'yyyy-mm-dd  ')  
    我这样写后怎么std_date=2007-05-16的时间都出来了呀,这跟没比较没啥区别呀,请问这是为什么?????===============================================================要看你这个V视图里的sql语句业务逻辑是什么了 ... 如果还不行那可能就是RP的问题 ...