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
                            
                        
                          
                          - MVC
- 오라클
- MST
- 코딩
- 디자인 패턴
- 데이터베이스
- 쿼리
- feign
- Spring
- db
- Jenkins
- Spring Cloud Feign
- aws
- Spring Boot
- retry
- 백준
- JPA
- Kafka
- 자료구조
- Intellj
- PL/SQL
- 클라우드
- golang
- 자바
- Spring Cloud
- DP
- 페이징
- 알고리즘
- 운영체제
- SQL
                            Archives
                            
                        
                          
                          - Today
- Total
justgo_developer
반복문(basic loop, while, for loop, continue) 본문
<basic loop문>
loop
pl/sql 문장;
exit(조건);
end loop;
ex)
| 1 2 3 4 5 6 7 8 9 10 | declare     num number := 0; begin     loop         dbms_output.put_line(num);         num := num + 1;         exit when num > 10;     end loop; end; | cs | 
<while문>
while 조건 loop
실행 문장;
end loop;
| 1 2 3 4 5 6 7 8 | declare     num number := 0; begin     while num < 11 loop         dbms_output.put_line(num);         num := num + 1;     end loop; end; | cs | 
<For 문> : 반복횟수 지정 가능
for n:카운트 횟수 in start..end loop
실행문장;
end loop;
| 1 2 3 4 5 6 | begin     for n in 0..10 loop         dbms_output.put_line(n);     end loop; end; | cs | 
| 1 2 3 4 5 6 | begin     for n in reverse 0..10 loop         dbms_output.put_line(n);     end loop; end; | cs | 
<사원테이블에서 사원id를 입력받아서 사원 이름의 문자수만큼 # 찍는 pl/sql문>
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | declare     emp_id employees.employee_id%type := &emp_no;     emp_name employee.last_name%type;     v_no number;     v_char varchar2(30); begin     select last_name, length(last_name) into emp_name, v_no     from employees     where employee_id = emp_id;     for i in 1..v_no loop         v_char := v_char||'#';         dbms_output.put_line(v_char);     end loop; end; | cs | 
<continue문 : 보조제어문>
| 1 2 3 4 5 6 7 8 9 10 11 | declare     tot number:=0; begin     for i in 1..10 loop         tot := tot+1;         dbms_output.put_line(tot);         continue when(i > 5);         tot := tot+i;         dbms_output.put_line(tot);     end loop; end; | cs | 
'IT > Oracle' 카테고리의 다른 글
| 커서의 의미와 사용예 (0) | 2018.12.09 | 
|---|---|
| 조건문(if문, case문) (0) | 2018.12.03 | 
| 콜렉션, 바인드 변수 (0) | 2018.12.02 | 
| rowType 변수 및 복합변수 활용 (0) | 2018.12.01 | 
| PL/SQL (0) | 2018.11.30 | 
