日期:2014-05-17  浏览次数:20703 次

oracle 初级菜鸟着急地问个日期匹配的问题
有个列列出了日期,其值形如:2006-9-3
我就找2006年的纪录,如何写
select   *   from   this_table   where   this_table.rcddate=   2006   ??????不对,怎么改

------解决方案--------------------
查询为2006年的纪录
select * from this_table where to_char(this_table.rcddate, 'YYYY ')= '2006 '

查询为200608月份的纪录
select * from this_table where to_char(this_table.rcddate, 'YYYYMM ')= '200608 '

查询为20060831月份的纪录
select * from this_table where to_char(this_table.rcddate, 'YYYYMMDD ')= '20060831 '