刚开始学习oracle,遇到一个问题:
用命令
select ename, sal, hiredate from emp
       where hiredate > '20-2月-80';提示无效的月份(not a valid month).
开始我还以为是输入问题,然后把输出的月份复制过来用还是提示无效的月份。
我想是不是因为oracle不能识别中文啊?
但是输出中文是没有问题啊
论坛里的达人们,求教啊
新手求赐教,求赐教。

解决方案 »

  1.   

    我把你的复制到我的sqlplus 上 完全没有问题
      

  2.   

    select ename, sal, hiredate from emp
      where hiredate > to_date('1980-02-20','yyyy-mm-dd');
      

  3.   

    这个to_date函数我是知道的,但是关键如一楼的所讲
    select ename, sal, hiredate from emp
      where hiredate > '20-2月-80';
    这条语句在他的机器上运行完全是没有问题的啊……
      

  4.   

    你应该查看一下你的sysdate的输出格式:select sysdate from dual;
    如果跟你的输入的 '20-2月-80',格式不匹配的话是不能直接比较的查看你的nls_langurage是否为SIMPLIFIED CHINESE:
    SQL> show parameter nls_languageNAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    nls_language                         string      SIMPLIFIED CHINESE
      

  5.   

    结果是  表或视图不存在……SQL> show parameter nls_language;
    ORA-00942: 表或视图不存在
    然后网上找到这个查了下:SQL> select userenv('language') from dual;USERENV('LANGUAGE')
    ----------------------------------------------------
    SIMPLIFIED CHINESE_CHINA.ZHS16GBK这个是怎么回事啊???
      

  6.   

    --时间比较 两种方式 一种to_date,一种to_char
    --to_char 至少不用考虑字符集..to_date 要不要考虑真没注意过
    select * from test where to_char(hiredate ,'yyyymmdd') > '20080220';select * from test where hiredate > to_date('20080220','yyyymmdd')