简单记录一个常用函数,用来提取当前时间(系统时间)的年月日时分秒数值
select extract(year from systimestamp) as 年
,extract(month from systimestamp) as 月
,extract(day from systimestamp) as 日
,extract(timezone_hour from systimestamp) + 1 as 时
,extract(minute from systimestamp) as 分
,ceil(extract(second from systimestamp)) as 秒
from dual
查询结果如下:

感谢您的阅读,如有错误或不足之处,敬请批评指正
本文介绍了一个实用的SQL函数,用于从系统时间戳中精确提取年、月、日、时、分、秒的数值。通过使用extract函数,可以轻松获取当前时间的各个组成部分。
3048

被折叠的 条评论
为什么被折叠?



