获取两个日期间的工作日,
SQL> select dt_time
2 from (select to_date('01-12-2010 08:20:56','dd-mm-yyyy HH:MI:SS') + level - 1 dt_time
3 from dual
4 connect by level <= sysdate - to_date('01-12-2010 08:20:56','dd-mm-yyyy HH:MI:SS') + 1
5 )
6 where to_char(dt_time,'d') not in ('1','7');
Oracle提供的层次查询(Hierarchical Queries)功能中的connect by子句可以协助我们便捷的达到目标。
1.创建测试表T
sec@ora10g> create table t (x int);
Table created.
2.使用“connect by level”完成插入1到10连续数字
sec@ora10g> insert into t select rownum from dual connect by level<=10;
10 rows created.
继续阅读与本文标签相同的文章
上一篇 :
MySQL全文索引的概念
-
20个堪称神器的 Linux 命令行软件
2026-05-26栏目: 教程
-
面试从不曾缺席,常见算法Java版
2026-05-26栏目: 教程
-
Second_Behind_Master值
2026-05-26栏目: 教程
-
MySQL之alter ignore 语法
2026-05-26栏目: 教程
-
ConcurrentHashMap竟然也有死循环问题?
2026-05-26栏目: 教程
