SELECT TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS') FROM DUAL;SELECT TO_DATE('2018-07-20 14:41:27', 'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
SELECT TO_CHAR(SYSDATE, 'yyyy') - TO_CHAR(T.BIRTHDAY, 'yyyy') AGE FROM TABLE T;
-- 取(0,1)之间的小数SELECT DBMS_RANDOM.VALUE FROM DUAL;-- 取0或1,四舍五入SELECT ROUND(DBMS_RANDOM.VALUE) FROM DUAL;
-- 圆周率πSELECT ACOS(-1) FROM DUAL; -- 3.14159265358979-- FLOOR:取整数位SELECT FLOOR(2345.67) FROM DUAL; -- 2345-- CEIL:大于或等于的最小整数SELECT CEIL(3.1415927) FROM DUAL; -- 4-- ROUND:四舍五入SELECT ROUND(3.1415926) FROM DUAL; -- 3SELECT ROUND(3.1415926,4) FROM DUAL; -- 3.1416-- TRUNC:截取指定精度SELECT TRUNC(3.1415926) FROM DUAL; -- 3SELECT TRUNC(3.1415926,4) FROM DUAL; -- 3.1415
参考资料