获的时间差,
SELECT
((sysdate-(CASE WHEN (Upd_date= ' ' or Upd_date is null)
THEN Pur_date ELSE Upd_date END)
)*24)/4*4 AS Begdate
FROM table1 WHERE Cfm_status=0
得到的结果:128.3883333333
123.522222222
10.233333333
5.365
请问怎样才能只得到:
128
123
10
5
怎么用to_char(sysdate, 'yyyy/MM/dd HH24 ')
不行~~~~~~
------解决方案--------------------
加个trunc函数即可 ...
SELECT
trunc(((sysdate-(CASE WHEN (Upd_date= ' ' or Upd_date is null)
THEN Pur_date ELSE Upd_date END)
)*24)/4*4) AS Begdate
FROM table1 WHERE Cfm_status=0
------解决方案--------------------
四舍五入:
select round(123.522222222) from dual;
去掉小数:
select trunc(123.522222222) from dual;
------解决方案--------------------
用ROUND()可以解决~~