liangcmwn / docs

mydocs on git
0 stars 0 forks source link

Sql::Oracle #4

Open liangcmwn opened 5 years ago

liangcmwn commented 5 years ago

时间戳转换为日期

TO_CHAR(t.create_time / (1000 60 60 * 24) + TO_DATE('1970-01-01 08:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS')

liangcmwn commented 5 years ago

序号 row_number()函数

select row_number() over(ORDER BY t.taskcreatetime),
t.ACTIVITYNAME,
t.TASKTYPE 
from t_sys_flow_task t 
ORDER BY t.taskcreatetime;
liangcmwn commented 5 years ago

当前时间转成long :

select sysdate, (SYSDATE - TO_DATE('1970-1-1 8', 'YYYY-MM-DD HH24')) * 86400000 + TO_NUMBER(TO_CHAR(SYSTIMESTAMP(3), 'FF')) AS MILLIONS from dual;