要得到精确到毫秒的时间直接用“TimeStamp”类型变量: declare cur_time timestamp; begin cur_time:=current_timestamp; dbms_output.put_line(to_char(cur_time)); end;
计算两个时间戳相隔的毫秒数。但是你有2楼的疑问,不知道timestamp是什么意思,那就不好说了。select extract(day from intv)*24*60*60*1000 +extract(hour from intv)*60*60*1000 +extract(minute from intv)*60*1000 +extract(second from intv)*1000 from (SELECT SYSTIMESTAMP-timestamp '2019-10-12 15:52:00' AS intv from dual);
declare
cur_time timestamp;
begin
cur_time:=current_timestamp;
dbms_output.put_line(to_char(cur_time));
end;
+extract(hour from intv)*60*60*1000
+extract(minute from intv)*60*1000
+extract(second from intv)*1000
from (SELECT SYSTIMESTAMP-timestamp '2019-10-12 15:52:00' AS intv from dual);