You are on page 1of 3

TUNIS BUSINESS SCHOOL

UNIVERSITY OF TUNIS

Introduction to PL/SQL language

Consider the following relational database designed to manage an


airline.

DBM (IT 300) 1


TUNIS BUSINESS SCHOOL
UNIVERSITY OF TUNIS

Questions:
A. Scalar Type: Statement of a simple type

1. Write a PL / SQL block that displays the number of existing pilot in the database. The
result will appear as follows:
The number of existing pilots in the database is:
11

2. Write a PL / SQL block that displays the commission and pilot hiring date that has the
highest salary. The result will appear as follows:
Commission:
0
Hiring Date: 03/15/93

B. Scalar Type: Statement of a type that references a table

3. Write a PL / SQL block that can display the name and salary of the pilot whose
number is 6723. The result will be displayed as follows:
The pilot name is: MARTIN
Salary is: 23150

4. Write a PL / SQL block that can display the name of the plane having made five
flights. The result returned after the execution is as follows:

declare
*
ERROR à la ligne 1 :
ORA-01403: Aucune donnée trouvée
ORA-06512: à ligne 4

C. Composite type

5. Write a PL / SQL block that can display the name and salary of the first hired pilot.
Propose two different solutions, the first based on the scalar and the second using
composite type. In both solutions, the result will be displayed as follows:
The pilot name is: DUVAL
Salary is: 18600

6. Write a PL / SQL block that can display the code type and number of aircraft of 'AB3'
type. Propose two different solutions, the first based on the scalar and the second
with composite type. In both solutions, the result will be displayed as follows:
The code type is: AB3
The number of aircraft is: 2

DBM (IT 300) 2


TUNIS BUSINESS SCHOOL
UNIVERSITY OF TUNIS

D. Variable Initialization

7. Write a PL / SQL block that allows you to insert the next record in the table device.

Device
Codetype nbplace Design

735 450 737-400

 Check whether the recording was made using the corresponding SQL statement.
 Add in PL-SQL block the necessary order to validate the insertion.

8. Write a PL / SQL block that calculates the average number of flight’s hours of the
aircraft. The default average is 13000.

E. Conditional Structures

9. Write a PL / SQL block that can increase the salary of 12% of the pilot No. 1333, if
and only if the value of the commission exceeds the value of his salary.
In case the salary is increased by 12%, consider the message “the salary is increased
by 12%” otherwise display the message "salary lower than the commission"

DBM (IT 300) 3

You might also like