We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
PLSQL and Trigger exercises
1. Create a procedure that outputs „Hello world!”!
2. Create a function which decides if the given number is a prime! 3. Create a function which calculates the factorial of a number! 4. Create a function which calculates how many times a string occurres in another string! 5. Create a function which returns the average salary of employees in a salary category! Use cursor! 6. Create a procedure which takes the employees in alphabetical order and outputs the name and salary of the ones with odd rownumber! Use cursor! 7. Create the table ’emp2’ from the table ’emp’ and add a row_num column to it! Create a procedure, which fills this column with increasing number in lexicongraphical order of the employees for every employee in emp2! Use cursor! 8. Create a procedure that increases the salary of those employees in ’emp2’ by 50% who have a prime number in the row_num column! Use cursor! 9. Create a procedure which deletes the employees in the given salary category from the table ’emp2’! Use cursor! 10. Create a procedure that increases the salary of the employees, whose salary is in the given salary category, by 1! After the modification, output the modified average of salary! 11. Create a view that shows the employee number, name, department number, name and location of the employees work in Boston or Chicago! Create a trigger that inserts rows into the base tables for the previous view instead of the view! 12. Create a trigger that creates a new department with the new deptno when someone tries to insert or update an employee in the emp table who works at a deptno which does not exists yet in the dept table!