当前位置:Gxlcms > 数据库问题 > ORACLE_TO_CHAR Function

ORACLE_TO_CHAR Function

时间:2021-07-01 10:21:17 帮助过:19人阅读

SELECT ename, hiredate, TO_CHAR((hiredate),‘fmDay‘) "Day"
FROM emp
ORDER BY "Day";

Answer: In the above SQL, the fmDay format mask used in the TO_CHAR function will return the name of the Day and not the numeric value of the day.

To sort the days of the week in order, you need to return the numeric value of the day by using the fmD format mask as follows:

SELECT ename, hiredate, TO_CHAR((hiredate),‘fmD‘) "Day"
FROM emp
ORDER BY "Day";

ORACLE_TO_CHAR Function

标签:version   11g   last   tran   eric   xpl   https   sse   some   

人气教程排行