Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ultimate-member domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /ledcorps/www/wp/wp-includes/functions.php on line 6114 5.2 조건제어(IF) – 대나무숲

5.2 조건제어(IF)

출처 http://www.gurubee.net/lecture/1060

IF문 문법

IF문 예제

 
SQL> CREATE OR REPLACE PROCEDURE Dept_Search
        (p_empno IN emp.empno%TYPE )

    IS

        v_deptno emp.deptno%type ;

    BEGIN

        DBMS_OUTPUT.ENABLE;

        SELECT deptno
        INTO v_deptno
        FROM emp
        WHERE empno = p_empno;

        IF v_deptno = 10 THEN

            DBMS_OUTPUT.PUT_LINE( ' ACCOUNTING 부서 사원입니다. ' );

        ELSIF v_deptno = 20 THEN

            DBMS_OUTPUT.PUT_LINE( ' RESEARCH 부서 사원입니다. ' );

        ELSIF v_deptno = 20 THEN

            DBMS_OUTPUT.PUT_LINE( ' SALES 부서 사원입니다. ' );

        ELSIF v_deptno = 20 THEN

            DBMS_OUTPUT.PUT_LINE( ' OPERATIONS 부서 사원입니다. ' );

        ELSE

            DBMS_OUTPUT.PUT_LINE( ' 부서가 이상해요... ' );

        END IF;

    EXCEPTION    
      WHEN   NO_DATA_FOUND  THEN  
        DBMS_OUTPUT.PUT_LINE(' 부서가 없네요... ');

    END ;
    /

 
-- DBMS_OUTPUT.PUT_LINE을 출력하기 위해 사용
SQL> SET SERVEROUTPUT ON ; 

-- 프로시저 실행
SQL> EXECUTE Dept_Search(7900);
부서가 없네요...


SQL> EXECUTE Dept_Search(7369);
RESEARCH 부서 사원입니다.
        

답글 남기기 0

Your email address will not be published. Required fields are marked *