select to_date('2018','yyyy') from dual为什么是系统月初时间?
例如:select to_date('2018','yyyy') from dual 
结果是:20180601

解决方案 »

  1.   

    官方文档写着呢
    https://docs.oracle.com/database/121/SQLRF/sql_elements001.htm#SQLRF0021The default date values are determined as follows:The year is the current year, as returned by SYSDATE.The month is the current month, as returned by SYSDATE.The day is 01 (the first day of the month).The hour, minute, and second are all 0.
    你要是想要一月一日,用这个
    select trunc(to_date('2018', 'yyyy'), 'y') from dual;