alter session set nls_date_format = 'YYYY-MON-DD HH24:MI:SS';

解决方案 »

  1.   

    客户端:\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\NLS_DATE_FORMAT设置为'YYYY-MON-DD HH24:MI:SS'
      

  2.   

    SQL> insert into test1 (doctime) values (to_date('2002-aug-01','yyyy-mm-dd'));
    insert into test1 (doctime) values (to_date('2002-aug-01','yyyy-mm-dd'))
                                                *
    ERROR at line 1:
    ORA-01858: a non-numeric character was found where a numeric was expectedSQL> alter session set nls_language='american';Session altered.SQL> commit;Commit complete.SQL> insert into test1 (doctime) values (to_date('2002-aug-01','yyyy-mm-dd'));1 row created.
      

  3.   

    insert into test1 (doctime) values (to_date('2002-aug-01','yyyy-mon-dd'));
      

  4.   

    values (to_date('2002-08-01','yyyy-mm-dd'))
    OR
    values (to_date('2002-aug-01','yyyy-mon-dd'))
      

  5.   

    各位大虾,我安装的是oracle8.1.6 中文版 ,插入的日期格式是23-JUN-99
    但提示是无效的月份。
    根据各位以上的建议我试了一下,现修改注册表将其nls-lang都改为了英文,
    在用alter session set nls_date_format语句。后才可通过。但是这样的话,我的sqlplus就不是中文的了。
    请问我想保持我原来的中文,又想让语句通过,是否有办法??????
      

  6.   

    没有办法满足你的要求。不过,SQLPLUS中文提示实在太难看了,一点都不习惯。
      

  7.   

    没有这么复杂吧!
    用to_date()就可以解决呀!
    要不把你的日期用程序变一下嘛!
      

  8.   

    SQL> alter session set nls_language='american';Session altered.SQL> commit;Commit complete.SQL> insert into test1 (doctime) values (to_date('2002-aug-01','yyyy-mm-dd'));1 row created.