728x90
조건문
-
Oracle - 조건문(IF, CASE)Database/Oracle 2022. 4. 27. 10:33
Oracle 조건문 IF 조건문 1. 사용법 IF 조건01 THEN 처리문 ELSIF 조건02 THEN 처리문 ... ELSE 처리문 END IF; IF 문은 조건이 참이면 해당 조건의 처리 문장이 실행된다. 사용법은 위와 같으며, 다른 언어와 비교하면 전체적인 구조는 크게 다르지 않지만 3가지가 다르다. 첫 번째는 조건 다음에 THEN을 붙인다는 것이고, 두 번째는 여러 개의 조건을 사용해야 하는 경우 ELSE IF가 아닌 ELSIF라는 명령어를 사용하는 것이다. 세 번째는 IF를 끝낸다는 END IF를 붙인다는 점에서 다르다. 2. 예제 DECLARE SCORE NUMBER := 80; BEGIN IF SCORE >= 90 THEN DBMS_OUTPUT.PUT_LINE('A 등급'); ELSIF SC..