PL - SQL Assignment
PL - SQL Assignment
1) WAP to input two numbers and find out what is the output of all arithmetic operations.
2) WAP to input rollno and three subject marks. Find out total, percentage, result and
grade for the student from the entered data.
3) WAP to print first 10 odd numbers using for loop.
5) WAP to input three nos and find out maximum and minimum from it.
6) WAP to input empno from keybord. Check whether inputed empno exist in emp table
or not. If not give error message otherwise display name and salary of that employee.
CURSORS:
1) Create a cursor for the emp table. Produce the output in following format:
2) Create a cursor for updating the salary of emp working in deptno 10 by 20%.
If any rows are affected than display the no of rows affected. Use implicit cursor.
3) Create a cursor for updating the salary of emp working in deptno 10 by 20%.
4) WAP that will display the name, department and salary of the first 10 employees
5) WAP using parameterized cursor to display all the information of employee living in
FUNCTIONS :
1)Write a function which accepts the name from user and returns the length of that name.
2)Write a function which accepts one number and return TRUE if no is prime and return FALSE if
no is not prime.
3) Write a function which accept the department no and returns maximum salary of that
department. Handle the error if deptno does not exist or select statement return more
5) Write a function which accepts one no and returns that no+100. Use INOUT mode.
6) Write a function which accepts the empno. If salary<10000 than give raise by 30%.
7) Write a function which accepts the empno and returns the experience in years. Handle the error if
empno does not exist.
PROCEDURES:
1) Write a procedure which accepts the empno and returns the associated empname. If
LOWER if name is in lowercase, MIXCASE if name is entered using both the case.
3) WAP which accepts the date of joining for specific employee and returns the years of
experience along with its name. Accept the Employee no from user.
TRIGGERS:
1 ) Write a trigger, that ensures the empno of emp table is in a format ‘E00001’ (empno
must start with ‘E’ and must be 6 characters long). If not than complete empno with this
2) Write a trigger which checks the age of employee while inserting the record in emp table. If it is
negative than generate the error and display proper message.
3) Write a trigger which converts the employee name in upper case if it is inserted in any
other case. Change should be done before the insertion only.
4) WAT that stores the data of emp table in emp_backup table for every delete operation
Emp_Backup(Empno,Empname,Date_of_operation,Type_of_operation(i.e.update or
delete));
6) WAT to calculate the Income Tax amount and insert it in emp table..
PACKAGE:
1) Write a package which consist of one function f_empchk and two procedures
Function will check the existence of empno. If it exists than update the record for that
employee using procedure proc_update. Otherwise insert the record using procedure
proc_insert.
In one function accept two number arguments and return the addition of them.
In the second function accept two character type arguments and return concatenated
string