Notice
                              
                          
                        
                          
                          
                            Recent Posts
                            
                        
                          
                          
                            Recent Comments
                            
                        
                          
                          
                            Link
                            
                        
                    | 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 
| 23 | 24 | 25 | 26 | 27 | 28 | 29 | 
| 30 | 
                            Tags
                            
                        
                          
                          - PL/SQL
- JPA
- DP
- Spring Cloud Feign
- golang
- 알고리즘
- feign
- 운영체제
- 쿼리
- MST
- 백준
- Jenkins
- Spring
- 페이징
- 디자인 패턴
- Spring Boot
- 오라클
- MVC
- 자바
- retry
- 클라우드
- aws
- Intellj
- db
- 데이터베이스
- Spring Cloud
- 자료구조
- 코딩
- Kafka
- SQL
                            Archives
                            
                        
                          
                          - Today
- Total
justgo_developer
계층형쿼리 본문
계층형 쿼리
example)
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | create table bom_phone(     item_id number(3) not null,     parent_id number(3),     item_name varchar2(20) not null,     primary key(item_id) ); insert into bom_phone values(100, null, '스마트폰'); insert into bom_phone values(101, 100, '메인PCB'); insert into bom_phone values(102, 100, '배터리'); insert into bom_phone values(103, 101, 'CPU'); select s1.item_name, s1.item_id, s2.item_name parent_name from bom_phone s1, bom_phone s2 where s1.parent_id = s2.item_id (+1) order by s1.item_id: | cs | 
<start with, connect by 절을 이용한 계층형 쿼리>
| 1 2 3 4 | select lpad(' ', 2*(level-1)) || item_name as itemnames from bom_phone start with parent_id is null connect by prior item_id = parent_id; | cs | 
'IT > Oracle' 카테고리의 다른 글
| 시퀀스(Sequence) (0) | 2018.11.22 | 
|---|---|
| PL/SQL (0) | 2018.11.18 | 
| 무결성 제약조건 (0) | 2018.10.27 | 
| DML(Data Manipulation Language) : select문, delete문, insert문, update문 (0) | 2018.10.21 | 
| DDL(Data Definition Language) : Create문, Drop문, Alter문, Truncate문 (0) | 2018.10.14 | 
