첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
CREATE OR REPLACE PROCEDURE DeleteDepartment(P_DEPTNO IN DEPT.DEPTNO%TYPE)
IS
    STILL_HAVE_EMPLOYEES EXCEPTION;

    -- ORA-2292 violated integrity constraining (OWNER.CONSTRAINT) - child record found.
    PRAGMA EXCEPTION_INIT(STILL_HAVE_EMPLOYEES, -2292);
BEGIN
    DELETE FROM DEPT WHERE DEPTNO = P_DEPTNO;
EXCEPTION
    WHEN STILL_HAVE_EMPLOYEES
    THEN
        DBMS_OUTPUT.PUT_LINE('임직원 데이터를 먼저 삭제해주시기 바랍니다.');
END;

SET SERVEROUTPUT ON;

BEGIN
    DeleteDepartment(10);
END;
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요