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

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

      1. <legend id='fSoKm'><style id='fSoKm'><dir id='fSoKm'><q id='fSoKm'></q></dir></style></legend>

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

      2. <tfoot id='fSoKm'></tfoot>

        检查当前日期是否在两个日期之间 Oracle SQL

        时间:2023-09-19

          <i id='rUR13'><tr id='rUR13'><dt id='rUR13'><q id='rUR13'><span id='rUR13'><b id='rUR13'><form id='rUR13'><ins id='rUR13'></ins><ul id='rUR13'></ul><sub id='rUR13'></sub></form><legend id='rUR13'></legend><bdo id='rUR13'><pre id='rUR13'><center id='rUR13'></center></pre></bdo></b><th id='rUR13'></th></span></q></dt></tr></i><div id='rUR13'><tfoot id='rUR13'></tfoot><dl id='rUR13'><fieldset id='rUR13'></fieldset></dl></div>
          <tfoot id='rUR13'></tfoot>
            <bdo id='rUR13'></bdo><ul id='rUR13'></ul>
            • <legend id='rUR13'><style id='rUR13'><dir id='rUR13'><q id='rUR13'></q></dir></style></legend>
              1. <small id='rUR13'></small><noframes id='rUR13'>

                  <tbody id='rUR13'></tbody>

                  本文介绍了检查当前日期是否在两个日期之间 Oracle SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如果当前日期介于 2 个日期之间,我想通过 Oracle SQL 选择 1.

                  I would like to select 1 if current date falls between 2 dates through Oracle SQL.

                  我在阅读其他问题后写了一个 SQL.

                  I wrote an SQL after reading through other questions.

                  https://stackoverflow.com/questions/2369222/oracle-date-between-query

                  https://stackoverflow.com/questions/2399753/select-from-table-by-knowing-only-date-without-time-oracle

                  但它只返回空值.sysdate01/05/2014 的当前日期,日期格式为DD/MM/YYYY.

                  But it returned only null. sysdate is the current date that is 01/05/2014 in date format DD/MM/YYYY.

                  我写的SQL是:

                  select 1 from dual 
                  WHERE to_date(sysdate,'DD/MM/YYYY') 
                  BETWEEN TO_DATE('28/02/2014', 'DD/MM/YYYY')
                  AND TO_DATE('20/06/2014', 'DD/MM/YYYY');
                  

                  select 1 from dual 
                  WHERE to_date(sysdate,'DD/MM/YYYY') >= TO_DATE('28/02/2014', 'DD/MM/YYYY') 
                  AND to_date(sysdate,'DD/MM/YYYY') < TO_DATE('20/06/2014', 'DD/MM/YYYY'); 
                  

                  推荐答案

                  您不需要将 to_date() 应用到 sysdate.它已经在那里了:

                  You don't need to apply to_date() to sysdate. It is already there:

                  select 1
                  from dual 
                  WHERE sysdate BETWEEN TO_DATE('28/02/2014', 'DD/MM/YYYY') AND TO_DATE('20/06/2014', 'DD/MM/YYYY');
                  

                  如果你关心日期上的时间分量,那么使用trunc():

                  If you are concerned about the time component on the date, then use trunc():

                  select 1
                  from dual 
                  WHERE trunc(sysdate) BETWEEN TO_DATE('28/02/2014', 'DD/MM/YYYY') AND
                                               TO_DATE('20/06/2014', 'DD/MM/YYYY');
                  

                  这篇关于检查当前日期是否在两个日期之间 Oracle SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 SqlAlchemy 和 cx_Oracle 将 Pandas DataFrame 写入 Oracle 数据库时加 下一篇:在 Oracle 行的多列上使用数据透视表

                  相关文章

                  <tfoot id='fYAio'></tfoot>
                    <bdo id='fYAio'></bdo><ul id='fYAio'></ul>

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

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

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