Vous êtes sur la page 1sur 1

PL*SQL Exercise 2

1. In a PL*SQL block, create a datatype by the name of addr_type. It should contain the following components:name varchar2 (20) street varchar2 (30) city varchar2 (20) state varchar2 (15) Your block should accept the names and addresses of 4 employees in 4 different variables of datatype addr_type. Output the names and addresses of the 4 employees on the screen in the form of Labels as shown below:************************************************************* * Name:Jack ** Name:Scott * * Street:M.G. Road ** Street:Bhosale Marg * * City:Mumbai ** City:Chennai * * State:Maharashtra ** State:Tamil Nadu * ************************************************************* ************************************************************* * Name:King ** Name:Adams * * Street:Lane No:-2 ** Street:P. M. Road * * City:Nagpur ** City:Bangalore * * State:Maharashtra ** State:Karnataka * *************************************************************

2. In a PL*SQL block, create a structure by the name of real_type to store real numbers. The structure real_type can be represented as:type real_type is record ( lft number (4), rgt number (2) ); where lft and rgt represent the digits to the left and right of the decimal point, respectively. If lft is a negative integer, the represented real number is negative. Your program should allow the user to input 2 real numbers in variables of datatype real_type. Write routines to add, subtract and multiply the two numbers and set the value of a third real number to represent the sum, difference, and product, respectively, of the 2 input numbers. Display the results on the screen using dbms_output.put_line. (Use decode instead of IF statement where required).

Sameer Dehadrai

Page: 1

Vous aimerez peut-être aussi