Prentice Hall Oracle Plsql By Example 3Rd Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Prentice Hall Oracle Plsql By Example 3Rd Edition [Electronic resources] - نسخه متنی

Benjamin Rosenzweig

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید



Lab 11.2 Exercises


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:

a)

What output is printed on the screen?

b)

Explain why the script does not execute successfully.

c)

Add a user-defined exception to the script, so that the error generated by the INSERT statement is handled.

d)

Run the new version of the script. Explain the output produced by the new version of the script.


    / 289