• <legend id='asjpj'><style id='asjpj'><dir id='asjpj'><q id='asjpj'></q></dir></style></legend>
        <bdo id='asjpj'></bdo><ul id='asjpj'></ul>

        <small id='asjpj'></small><noframes id='asjpj'>

        <i id='asjpj'><tr id='asjpj'><dt id='asjpj'><q id='asjpj'><span id='asjpj'><b id='asjpj'><form id='asjpj'><ins id='asjpj'></ins><ul id='asjpj'></ul><sub id='asjpj'></sub></form><legend id='asjpj'></legend><bdo id='asjpj'><pre id='asjpj'><center id='asjpj'></center></pre></bdo></b><th id='asjpj'></th></span></q></dt></tr></i><div id='asjpj'><tfoot id='asjpj'></tfoot><dl id='asjpj'><fieldset id='asjpj'></fieldset></dl></div>
        <tfoot id='asjpj'></tfoot>

      1. 以毫秒为单位计算 Oracle 中两个时间戳之间的差异

        Calculating difference between two timestamps in Oracle in milliseconds(以毫秒为单位计算 Oracle 中两个时间戳之间的差异)

        1. <tfoot id='ljPse'></tfoot>

          <small id='ljPse'></small><noframes id='ljPse'>

            <tbody id='ljPse'></tbody>

        2. <i id='ljPse'><tr id='ljPse'><dt id='ljPse'><q id='ljPse'><span id='ljPse'><b id='ljPse'><form id='ljPse'><ins id='ljPse'></ins><ul id='ljPse'></ul><sub id='ljPse'></sub></form><legend id='ljPse'></legend><bdo id='ljPse'><pre id='ljPse'><center id='ljPse'></center></pre></bdo></b><th id='ljPse'></th></span></q></dt></tr></i><div id='ljPse'><tfoot id='ljPse'></tfoot><dl id='ljPse'><fieldset id='ljPse'></fieldset></dl></div>
        3. <legend id='ljPse'><style id='ljPse'><dir id='ljPse'><q id='ljPse'></q></dir></style></legend>

                  <bdo id='ljPse'></bdo><ul id='ljPse'></ul>
                  本文介绍了以毫秒为单位计算 Oracle 中两个时间戳之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何计算 Oracle 中两个时间戳之间的时间差(以毫秒为单位)?

                  How do I calculate the time difference in milliseconds between two timestamps in Oracle?

                  推荐答案

                  当你减去两个 TIMESTAMP 类型的变量时,你得到一个 INTERVAL DAY TO SECOND,其中包括一个取决于平台的毫秒数和/或微秒数.如果数据库在 Windows 上运行,systimestamp 通常会有毫秒.如果数据库在 Unix 上运行,systimestamp 通常会有微秒.

                  When you subtract two variables of type TIMESTAMP, you get an INTERVAL DAY TO SECOND which includes a number of milliseconds and/or microseconds depending on the platform. If the database is running on Windows, systimestamp will generally have milliseconds. If the database is running on Unix, systimestamp will generally have microseconds.

                    1  select systimestamp - to_timestamp( '2012-07-23', 'yyyy-mm-dd' )
                    2*   from dual
                  SQL> /
                  
                  SYSTIMESTAMP-TO_TIMESTAMP('2012-07-23','YYYY-MM-DD')
                  ---------------------------------------------------------------------------
                  +000000000 14:51:04.339000000
                  

                  您可以使用 EXTRACT 函数来提取 INTERVAL DAY TO SECOND 的各个元素

                  You can use the EXTRACT function to extract the individual elements of an INTERVAL DAY TO SECOND

                  SQL> ed
                  Wrote file afiedt.buf
                  
                    1  select extract( day from diff ) days,
                    2         extract( hour from diff ) hours,
                    3         extract( minute from diff ) minutes,
                    4         extract( second from diff ) seconds
                    5    from (select systimestamp - to_timestamp( '2012-07-23', 'yyyy-mm-dd' ) diff
                    6*           from dual)
                  SQL> /
                  
                        DAYS      HOURS    MINUTES    SECONDS
                  ---------- ---------- ---------- ----------
                           0         14         55     37.936
                  

                  然后您可以将这些组件中的每一个转换为毫秒并将它们相加

                  You can then convert each of those components into milliseconds and add them up

                  SQL> ed
                  Wrote file afiedt.buf
                  
                    1  select extract( day from diff )*24*60*60*1000 +
                    2         extract( hour from diff )*60*60*1000 +
                    3         extract( minute from diff )*60*1000 +
                    4         round(extract( second from diff )*1000) total_milliseconds
                    5    from (select systimestamp - to_timestamp( '2012-07-23', 'yyyy-mm-dd' ) diff
                    6*           from dual)
                  SQL> /
                  
                  TOTAL_MILLISECONDS
                  ------------------
                            53831842
                  

                  然而,通常情况下,使用 INTERVAL DAY TO SECOND 表示或为小时、分钟、秒等设置单独的列比计算之间的总毫秒数更有用两个 TIMESTAMP 值.

                  Normally, however, it is more useful to have either the INTERVAL DAY TO SECOND representation or to have separate columns for hours, minutes, seconds, etc. rather than computing the total number of milliseconds between two TIMESTAMP values.

                  这篇关于以毫秒为单位计算 Oracle 中两个时间戳之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                  <tfoot id='MPk2B'></tfoot>

                    <i id='MPk2B'><tr id='MPk2B'><dt id='MPk2B'><q id='MPk2B'><span id='MPk2B'><b id='MPk2B'><form id='MPk2B'><ins id='MPk2B'></ins><ul id='MPk2B'></ul><sub id='MPk2B'></sub></form><legend id='MPk2B'></legend><bdo id='MPk2B'><pre id='MPk2B'><center id='MPk2B'></center></pre></bdo></b><th id='MPk2B'></th></span></q></dt></tr></i><div id='MPk2B'><tfoot id='MPk2B'></tfoot><dl id='MPk2B'><fieldset id='MPk2B'></fieldset></dl></div>
                      <tbody id='MPk2B'></tbody>

                        <legend id='MPk2B'><style id='MPk2B'><dir id='MPk2B'><q id='MPk2B'></q></dir></style></legend>

                        <small id='MPk2B'></small><noframes id='MPk2B'>

                        • <bdo id='MPk2B'></bdo><ul id='MPk2B'></ul>