Академический Документы
Профессиональный Документы
Культура Документы
Version 1.0
Use: Students/Staff
2ORC PL/SQL Fundamentals
Graded Exercise
SOMMAIRE
1 INTRODUCTION .............................................................................................. 3
2 QUESTIONS .................................................................................................... 4
2.1 4 POINTS ......................................................................................................... 4
2.2 4 POINTS ........................................................................................................ 4
2.3 3 POINTS ......................................................................................................... 4
2.4 4 POINTS ........................................................................................................ 5
2.5 3 POINTS ......................................................................................................... 5
2.6 2 POINTS ........................................................................................................ 5
Page 2 sur 5
SUPINFO International University http://www.supinfo.com
2ORC PL/SQL Fundamentals
Graded Exercise
1 INTRODUCTION
You have access to course materials (ppt+labs) for this exam, but not to internet nor any other
resource.
You must write all your answers in a single file TXT file with your scripts and comments.
To carry out your work, you have at your disposal the olvoyage schema, which contains sample
data. Its password is oracle. It contains the following tables:
Page 3 sur 5
SUPINFO International University http://www.supinfo.com
2ORC PL/SQL Fundamentals
Graded Exercise
2 QUESTIONS
2.1 4 POINTS
Create a procedure that accepts a customer's last name as parameter and returns:
o the customer_id (buyer_id)
o the number of reservations he made (count)
o the total amount for his reservations (sum of price)
Use OUT parameters to return the data
If the last name doesn't exists, an exception shall be raised. Handle it and print a custom
message.
If the last name have more than one occurrence (ex : Cunningham), an exception shall be
raised. Handle it and print a custom message.
Test your procedure using an anonymous block and a bind variables.
Display the content of these variables after the execution.
2.2 4 POINTS
2.3 3 POINTS
Page 4 sur 5
SUPINFO International University http://www.supinfo.com
2ORC PL/SQL Fundamentals
Graded Exercise
2.4 4 POINTS
Create a procedure named add_employee, which inserts a new row in the t_employee
table.
Use the seq_t_employee sequence to generate its id; the value of the remaining columns
shall be passed as parameters.
Define default values for the following columns:
o Login : use the last name followed by the first letter of the first name
o Pass : use the three last letters of the last name, followed by the three last letters
of the first name
o Salary : use the minimal salary currently stored in the t_employee table
o Comm_pct, manager_id : NULL
In order to check that your procedure works properly, execute it with only the mandatory
parameters (the last name and the first name).
2.5 3 POINTS
Test your procedure to create an index on the last_name column in the t_customer table
2.6 2 POINTS
Page 5 sur 5
SUPINFO International University http://www.supinfo.com