2
SELECT  TO_DATE('21-Jul-2013') + (LEVEL * 5/1440) ts5,
                        TO_DATE('21-Jul-2013') + (LEVEL * 5/1440) + 
                            DECODE(TO_CHAR(TO_DATE('21-Jul-2013') + (LEVEL * 5/1440),'mi'),
                                    '05',10,'10',5,'20',10,'25',5,
                                    '35',10,'40',5,'50',10,'55',5,0)/1440 ts15  
                  FROM dual
                CONNECT BY LEVEL BETWEEN 1 AND 288

这仅提供一天的数据,我将如何更改它以使其适用于日期范围

4

2 回答 2

2

尝试这个:

您可以更改结束日期

SELECT
      TO_DATE ( '21-Jul-2013' )
      + (  LEVEL
        * 5
        / 1440 )
          TS5,
        TO_DATE ( '21-Jul-2013' )
      + (  LEVEL
        * 5
        / 1440 )
      + DECODE ( TO_CHAR ( TO_DATE ( '21-Jul-2013' )
                       + (  LEVEL
                         * 5
                         / 1440 ),
                       'mi' ),
               '05', 10,
               '10', 5,
               '20', 10,
               '25', 5,
               '35', 10,
               '40', 5,
               '50', 10,
               '55', 5,
               0 )
        / 1440
          TS15
FROM
      DUAL
CONNECT BY
      LEVEL BETWEEN 1 AND ((TO_DATE ( '23-Jul-2013' ) - TO_DATE ( '21-Jul-2013' ))*24*60/5);
于 2013-10-11T09:07:38.563 回答
0

你是这个意思吗:

SELECT TO_DATE('21-Jul-2013') + (LEVEL * 5/1440) ts5,
...
from dual
connect by level <= (to_date('23-Jul-2013') - to_date('21-Jul-2013'))* 24*60/5;
于 2013-10-11T08:59:48.970 回答