July 2006
Intermediate to advanced
560 pages
12h 57m
English
PL/SQL is a procedural programming language that's built into Oracle XE. With PL/SQL, you can build programs to process information by combining PL/SQL procedural statements that control program flow with SQL statements that access an Oracle database. For example, the following is a very simple PL/SQL program that updates a part's UNITPRICE, given the part's ID number. (This listing is not an exercise—it is just an example to study.)
CREATE OR REPLACE PROCEDURE updatePartPrice ( partId IN INTEGER, newPrice IN NUMBER ) IS invalidPart EXCEPTION; BEGIN -- HERE'S AN UPDATE STATEMENT TO UPDATE A DATABASE RECORD UPDATE parts SET unitprice = newPrice WHERE id= partId; -- HERE'S AN ERROR-CHECKING STATEMENT IF SQL%NOTFOUND THEN RAISE invalidPart; ...
Read now
Unlock full access