Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

BIPM PL/SQL Exercises

I ) Write PL/SQL anonymous blocks to perform the below operations

1. Accept two numbers as input and print the sum of those numbers.

2. Accept three numbers as input and print the biggest of the three.

3. Accept a date and display the quarter to which the date belongs to

4. Accept two different numbers and find addition, subtraction, multiplication and division of
given two numbers using CASE

5. To find the sum of first hundred odd numbers.

6. To print the number of times a specified character is appearing in a given string. String and the
character should be given as input.

7. To accept the product_id, product_description, quantity and unit price as input. Now calculate the bill. If
the bill is more than 500 and less than 1500 give a discount of 5%. If bill amount is more than 1500 then
10% discount. Otherwise there is no discount. Display all the details along with bill amount, discount,
net payable.

II ) Copy the below tables from info_faculty schema to your working schema using CREATE AS
SELECT.. statement.

info_faculty.wc_dept

DEPT_CD VARCHAR2(5)
DEPT_NAME VARCHAR2(25)

info_faculty.wc_doctor

DOC_ID NUMBER
DOC_NAME VARCHAR2(50)
DEPT_CD VARCHAR2(5)
CONSULT_FEE NUMBER

info_faculty.wc_patient

CONSULT_ID NUMBER
PATIENT_NAME VARCHAR2(50)
DOC_ID NUMBER

© TCS Internal Page 1


BIPM PL/SQL Exercises

1. Write a PL/SQL block to accept a consultation_id as input and display the corresponding doctor
name and patient_name.
2. Write a PL/SQL block to accept a doctor_id as input and update the consultation fees of that
doctor by an increment of 10% if the consultation fees is less than 500.
3. Write a Pl/SQL block to accept a doctor_id as input and the delete all records from patient table
where doctor_id is same as the input doctor_ID.

© TCS Internal Page 2

You might also like