oracle语句,时分秒格式转成秒
select (hours+minutes+seconds) AS total_seconds from ( select to_char(sysdate,('HH24'))*60*60 AS hours, to_char(sysdate,('mi'))*60 AS minutes, to_char(sysdate,'ss') AS seconds from A );
解读:
AS:是给前面的结果指定一个新的列
HH21:时
mi:分
ss:秒
算出小时和分钟的秒数,然后秒就不用算了,在后面直接相加,hours+minutes+seconds,指定给新的列total_seconds