trunc取得是天(可比较),而to_char取得是数值(可计算):
但trunc(date) 具有与to_char(date) 相似的功能,但有区别:
trunc(sysdate,'cc') 取当世纪的第一天 to_char(sysdate,'cc') 取当世纪数值
trunc(sysdate,'yyyy') 取当年的第一天 to_char(sysdate,'yyyy') 取当年数值
trunc(sysdate,'iyyy') 取上年的最后一天 to_char(sysdate,'iyyy') 取当年数值
trunc(sysdate,'q') 取当季第一天 to_char(sysdate,'iyyy') 取当季数值
trunc(sysdate,'mm') 取当月第一天 to_char(sysdate,'mm') 取当月数值
trunc(sysdate,'ww') 取当周第一天(周二) to_char(sysdate,'ww') 取当周数值(第几周)
trunc(sysdate,'iw') 取当周第一天(周一) to_char(sysdate,'iw') 取当周数值(第几周)