Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 在Oracle中显示(2015年1月1日)到今天之间的所有日期_Sql_Oracle_Date - Fatal编程技术网

Sql 在Oracle中显示(2015年1月1日)到今天之间的所有日期

Sql 在Oracle中显示(2015年1月1日)到今天之间的所有日期,sql,oracle,date,Sql,Oracle,Date,这是我的 with a as (select 1 as k, to_date('01/01/2015', 'mm/dd/yyyy') as temp from dual), b as (select 1 as k, sysdate as t from dual) select * from a join b on a.k = b.k where a.temp between a.temp and b.t 现在,我想显示这两个日期之间的所有日期 我如何生成它 最好的,你离得太近了 with

这是我的

with 
a as
(select 1 as k, to_date('01/01/2015', 'mm/dd/yyyy') as temp from dual),
b as
(select 1 as k, sysdate as t from dual)

select * from a
join b on a.k = b.k
where a.temp between a.temp and b.t
现在,我想显示这两个日期之间的所有日期

我如何生成它

最好的,

你离得太近了

with 
a as
(select 1 as k, to_date('01/01/2015', 'mm/dd/yyyy') as temp from dual),
b as
(select 1 as k, sysdate as t from dual)
select a.temp + level - 1 result from a          --> this
join b on a.k = b.k
where a.temp between a.temp and b.t
connect by level <= b.t - a.temp + 1;            --> this
结果是

RESULT                                                                          
----------                                                                      
01/01/2015                                                                      
02/01/2015                                                                      
03/01/2015                                                                      
04/01/2015 

<snip>

28/10/2019
29/10/2019
30/10/2019
31/10/2019

1765 rows selected.

SQL>