The case_not_found exception is an predefined exception of PL/SQL language and catch error when executing CASE statement and no data is found.
Case_not_found example
declare gen students.gender%TYPE; stu students.student_id%TYPE := 3; message VARCHAR2(250); begin SELECT gender INTO gen from students WHERE student_id = stu; dbms_output.put_line('Gender is: '||gen); CASE WHEN gen = 'M' THEN message := 'MALE'; --WHEN gen = 'F' THEN message := 'FEMALE'; END CASE; dbms_output.put_line('Message: '||message); exception when case_not_found then dbms_output.put_line('CASE_NOT_FOUND: '||sqlerrm); end;
Output:
Gender is: F
CASE_NOT_FOUND: ORA-06592: CASE not found while executing CASE statement