SELECT TRUNC(TO_DATE('27-OCT-92','DD-MON-YY'), 'YEAR') "New Year" FROM DUAL;返回什么呀?
这是我从ORACLE官方网站上看到的SQL语句,执行的时候竟然提示:ERROR 位于第 1 行:
ORA-01843: 无效的月份
但是,官方网站上给的运行结果是:
TRUNC (date function)
Syntax
Purpose
TRUNC returns d with the time portion of the day truncated to the unit specified by
the format model fmt. If you omit fmt, d is truncated to the nearest day.
See Also: "ROUND and TRUNC Date Functions" on page 4-127
for the permitted format models to use in fmtNew Year
Example
SELECT TRUNC(TO_DATE(’27-OCT-92’,’DD-MON-YY’), ’YEAR’)
"New Year" FROM DUAL;
New Year
---------
01-JAN-92
到底这个函数是啥意思呀?