w3resource

PL/SQL Control Statement Exercises with Solution

PL/SQL Control Statement [ 30 exercises with solution ]

1. Write a PL/SQL program to arrange the number of two variable in such a way that the small number will store in num_small variable and large number will store in num_large variable.

Click me to see the solution

2. Write a PL/SQL procedure to calculate the incentive on a target achieved and display the message either the record updated or not.

Click me to see the solution

3. Write a PL/SQL program to check whether a number is even or odd.

Click me to see the solution

4. Write a PL/SQL procedure to calculate the incentive on a specific target otherwise a general incentive to be paid using IF-THEN-ELSE.

Click me to see the solution

5. Write a PL/SQL program to check whether a date falls on weekend i.e. SATURDAY or SUNDAY.

Click me to see the solution

6. Write a PL/SQL procedure to calculate incentive achieved according to the specific sale limit.

Click me to see the solution

7. Write a PL/SQL program to count number of employees in department 50 and check whether this department have any vacancies or not. There are 45 vacancies in this department.

Click me to see the solution

8. Write a PL/SQL program to display the description against a grade.

Click me to see the solution

9. Write a PL/SQL program to count number of employees in a specific department and check whether this department have any vacancies or not. If any vacancies, how many vacancies are in that department.

Click me to see the solution

10. Write a PL/SQL program to display the description against a grade using CASE statement.

Click me to see the solution

11. Write a PL/SQL program to display the description against a grade using CASE statement with EXCEPTION.

Click me to see the solution

12. Write a PL/SQL program to check whether a given number is positive, negative or zero.

Click me to see the solution

13. Write a PL/SQL program to check whether a given character is letter or digit.

Click me to see the solution

14. Write a PL/SQL program to convert a temperature in scale Fahrenheit to Celsius and vice versa.

Click me to see the solution

15. Write a PL/SQL program to display which day is a specific date.

Click me to see the solution

16. Write a program in PL/SQL to print the value of a variable inside and outside a loop using LOOP EXIT statement.

Click me to see the solution

17. Write a program in PL/SQL to print the value of a variable inside and outside a loop using LOOP WHEN EXIT statement.

Click me to see the solution

18. Write a program in PL/SQL to show the uses of nested loop.

Click me to see the solution

19. Write a program in PL/SQL to update the salary of a specifc employee by 8% if the salary exceeds the mid range of the salary against this job and update up to mid range if the salary is less than the mid range of the salary, and display a suitable message.

Click me to see the solution

20. Write a program in PL/SQL using nested loop with EXIT WHEN statement.

Click me to see the solution

21. Write a program in PL/SQL using loop with CONTINUE statement.

Click me to see the solution

22. Write a program in PL/SQL using loop with CONTINUE WHEN statement.

Click me to see the solution

23. Write a program in PL/SQL to print 1st n numbers.

Click me to see the solution

24. Write a program in PL/SQL to print 1st n numbers with a difference of 3 and starting from 1.

Click me to see the solution

25. Write a program in PL/SQL to show the value of a same variable declared as local and global.

Click me to see the solution

26. Write a program in PL/SQL to explain the uses of nested for loop with label.

Click me to see the solution

27. Write a program in PL/SQL to print the prime numbers between 1 to 50.

Click me to see the solution

28. Write a program in PL/SQL to check whether a number is prime or not using goto statement with for loop.

Click me to see the solution

29. Write a program in PL/SQL to insert records from one table to another.

Click me to see the solution

30. Write a program in PL/SQL to insert a row if the featched value for a component is specified.

Click me to see the solution



Follow us on Facebook and Twitter for latest update.