Generate a range of dates using SQL

前端 未结 15 1383
面向向阳花
面向向阳花 2020-11-28 05:47

I have a SQL query that takes a date parameter (if I were to throw it into a function) and I need to run it on every day of the last year.

How to generate a list of

15条回答
  •  不知归路
    2020-11-28 06:04

    Oracle specific, and doesn't rely on pre-existing large tables or complicated system views over data dictionary objects.

    SELECT c1 from dual
      MODEL DIMENSION BY (1 as rn)  MEASURES (sysdate as c1)
      RULES ITERATE (365) 
      (c1[ITERATION_NUMBER]=SYSDATE-ITERATION_NUMBER)
    order by 1
    

提交回复
热议问题