Consider the following PL/SQL script: SET SERVEROUTPUT ON BEGIN     INSERT INTO COURSE       (course_no, description, created_by, created-date, modified_by, modified_date)       VALUES       (course_no_seq.nextval, ‘database development’, USER, SYSDATE);      COMMIT      DBMS_OUTPUT.PUT_LINE (‘One course has been added’);  END;  Assumptions: All the COURSE table fields have check constraints defined on them indicating that none can be null.                   Explain why the script does not execute successfully. Add a user-defined exception to the script, so that the error generated by the INSERT statement is handled. Assign the code 2290 to this exception

A Guide to SQL
9th Edition
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Philip J. Pratt
Chapter3: Creating Tables
Section: Chapter Questions
Problem 4CAT
icon
Related questions
Question

Consider the following PL/SQL script:

SET SERVEROUTPUT ON

BEGIN

    INSERT INTO COURSE

      (course_no, description, created_by, created-date, modified_by, modified_date)

      VALUES

      (course_no_seq.nextval, ‘database development’, USER, SYSDATE);

     COMMIT

     DBMS_OUTPUT.PUT_LINE (‘One course has been added’);

 END;

 Assumptions: All the COURSE table fields have check constraints defined on them indicating that none can be null.                

 

  1. Explain why the script does not execute successfully.
  2. Add a user-defined exception to the script, so that the error generated by the INSERT statement is handled. Assign the code 2290 to this exception.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Procedures in SQL
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr