Home > Database > Mysql Tutorial > oracle connect by 用法

oracle connect by 用法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:08:13
Original
1926 people have browsed it

Oracle中可以通过START WITH . . . CONNECT BY . . .子句来实现SQL的层次查询,即递归查询 例如: select level||月 月份 from dualconnect by level 13; 或者 select rownum||月 月份 from dualconnect by rownum 13; 可以递归查询出12个月 1 1月 2 2月 3 3

Oracle中可以通过START WITH . . . CONNECT BY . . .子句来实现SQL的层次查询,即递归查询

例如:

select level||'月' 月份
  from dual
connect by level 
<p><br>
或者</p>
<pre class="brush:php;toolbar:false">select rownum||'月' 月份
  from dual
connect by rownum 
<p>可以递归查询出12个月</p>
<p>1    1月<br>
2    2月<br>
3    3月<br>
4    4月<br>
5    5月<br>
6    6月<br>
7    7月<br>
8    8月<br>
9    9月<br>
10 10月<br>
11 11月<br>
12 12月</p>
<p><br>
 </p>


Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template