Lab 11.3 Exercises


11.3.1 Use SQLCODE and SQLERRM

In this exercise, you add a new record to the ZIPCODE table. The original PL/SQL script does not contain any exception handlers. You are asked to add an exception-handling section to this script.

Create the following PL/SQL script:

 
 -- ch11_3a.sql, version 1.0 SET SERVEROUTPUT ON BEGIN    INSERT INTO ZIPCODE       (zip, city, state, created_by, created_date, modified_by, modified_date)    VALUES (       '10027', 'NEW YORK', 'NY', USER, SYSDATE, USER, SYSDATE);    COMMIT; END; 

Execute the script and answer the following questions:

a)

What output is printed on the screen?

b)

Modify the script so that the script completes successfully, and the error number and message are displayed on the screen.

c)

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




Oracle PL[s]SQL by Example
Oracle PL[s]SQL by Example
ISBN: 3642256902
EAN: N/A
Year: 2003
Pages: 289

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net