在使用oracle中的日期是需要注意:
1. oracle中默认的日期格式为: dd-Mon-yy
如: '11-1月-10'是指2010年1月11号
2.修改日期默认格式的命令:
alter session set nls_date_format = 'yyyy-mm-dd'
3.在使用日期类型进行比较查询时需注意:
如:查出1982年1月1号以后入职的员工:
select ename,hiredate from emp where[color=red] hiredate > '1-1月-1982'[/color];
一定要注意比较日期时的写法,如红色部分所示。
1. oracle中默认的日期格式为: dd-Mon-yy
如: '11-1月-10'是指2010年1月11号
2.修改日期默认格式的命令:
alter session set nls_date_format = 'yyyy-mm-dd'
3.在使用日期类型进行比较查询时需注意:
如:查出1982年1月1号以后入职的员工:
select ename,hiredate from emp where[color=red] hiredate > '1-1月-1982'[/color];
一定要注意比较日期时的写法,如红色部分所示。