Tutorial 06
Tutorial 06
28.04.2004
Introduction
In this exercise, we will have a look at stored procedures in Oracle. As there are no
tutorials this week due to Anzac day, we will just have a short look into these topics.
You should be able to solve the following exercise either within the School or back home
(assuming that you have internet access). You only need access to our courses web site.
There, you will find both the online documentation for Oracle PL/SQL, as well as access
to our course’s Oracle database via iSQL*Plus (its web front-end we used so far).
Tip 1: The general syntax for creating a new stored procedure with Oracle differs from
the SQL1999 standard. It is as follows:
where name is the name of the stored procedure and paramX is a parameter declaration
of the form parametername IN SQL-domain-type
1
Tip 2: In case of an error, Oracle just answers with Warning: Procedure created with
compilation errors. To see more details on this compilation error, add the following two
lines after your procedure code (the first line is just a ’/’):
/
SHOW ERRORS;
Tip 3: Start with creating a new empty stored procedure which takes the correct param-
eters but just adds the first tuple into accident. If this works, think about how to add the
second tuple into involved where you have to query two values from the database. Ac-
tually, you can solve this exercise without using PL/SQL at all but just with a sequence of
SQL commands. The solution is very similar to the solution of question 4 of the previous
tutorial.