DBS-BIT&BSE-Lab 09 PL - SQL
DBS-BIT&BSE-Lab 09 PL - SQL
DBS-BIT&BSE-Lab 09 PL - SQL
Instructions:
1. Gossips are not allowed.
2. Teacher assistants are for your help, so be nice with them. Respect them as they are
teaching you. Raise your hands if you have some problem and need help from TA. Avoid
calling them by raising your voice and disturbing the environment of Lab.
3. TA may deduct your marks for any kind of ill-discipline or misconduct from your side.
4. Evaluation will be considered final and you cannot debate for the marks. So, focus on
performing the tasks when the time is given to you.
5. Paste the query as well as result table screenshot as a result of each task
Sample:
Display All the Employees from emp table
Solution:
Select * from emp
2. Write a program that receives a string from the user. The program should
display the string on the screen, and determine whether length of the string
is even or odd? (2)
3. Write a program that retrieves ename, job, and dname of a certain employee
and outputs the message in the format "<ename> is a <job> working in
<dname>". The program should also handle the exception of
"NO_DATA_FOUND". (3)
4. Write a program that retrieves sal of a certain employee and assign it to one
out of three possible categories, "Low", "Average", or "High" on the basis of
sal amount <1000, 1000 to 1500, and above 1500 respectively. (2)
5. Write a PL/SQL block that prompts the user to input an employee’s number.
Retrieve the employee's name, job title, salary, and department name.
Display this information along with a message that shows if the employee's
salary is above or below the average salary of their department. (3)
8. Write a PL/SQL program that retrieves the sal and comm of an employee, if
the employee is a salesman. For other employees, the program should only
retrieve sal of the given employee. The program should raise the sal by 15%,
and comm by 10% for salesman. For other employees, the sal should be
raised by 20%. The maximum allowable raise in the net salary is 500$. If the
raise in the net salary exceeds 500$, then the net salary will be raised by
fixed 500$. The program should display all the details related to the
computations of the raise in sal. (5)
9. Develop a PL/SQL block that generates a pattern of stars (*) based on the
employee's salary. For each thousand dollars in salary, display a star. For
instance, if an employee earns $2500, display two stars. (5)
10. The company has decided to award bonus to its employees on the basis of
the grade of the employee. The employees with grade 1,2,3,4,5 will be
awarded a bonus amounting 50%,40%,30%,20%,10% of the sal
respectively. Write a PL/SQL program that receives empno of an employee,
and displays ename, grade, sal, and bonus. The program should also handle
the exception of "NO_DATA_FOUND". (5)
11. Write a PL/SQL program that displays the name of an employee in the
following format:
(4+1)
a)
S
M
I
T
H
b)
S
*M
**I
***T
****H