Oracle 从 dual 表中查询返回多行记录

 select 1 as id,'是' as text from dual
 union all
 select 0 as id ,'否' as text from dual

 

 

同时查询出十条数据

select * from dual connect by 0 + level <= 10;

 

按照这个特性计算两个日期之间的工作日:

复制代码
select days, week
  from (select to_date('2010-08-01', 'YYYY-MM-DD') + level - 1 as days,
               to_char(to_date('2010-08-01', 'YYYY-MM-DD') + level - 1,
                       'day') as week
          from dual
        connect by to_date('2010-08-30', 'YYYY-MM-DD') - level + 1 >=
                   to_date('2010-08-01', 'YYYY-MM-DD'))
 where week not in('saturday','sunday');
复制代码
posted on 2021-06-26 16:09  云淡风轻博客  阅读(1680)  评论(0编辑  收藏  举报