11.2.1 Use EXCEPTION_INIT Pragma
In this exercise, you insert a record in the COURSE table. The original PL/SQL script does not contain any exception handlers, so you are asked to define an exception and add the EXCEPTION_INIT pragma.
Create the following PL/SQL script:
-- ch11_2a.sql, version 1.0 SET SERVEROUTPUT ON BEGIN INSERT INTO course (course_no, description, created_by, created_date) VALUES (COURSE_NO_SEQ.NEXTVAL, 'TEST COURSE', USER, SYSDATE); COMMIT; DBMS_OUTPUT.PUT_LINE ('One course has been added'); END;
Execute the script, and then answer the following questions: