PLSQL: DECISION CONTROL STATEMENT: IF, IF-ELSE, IF-ELSIF-ELSE, CASE
31 programming challenges to help you master the fundamentals of DATABASE MANAGEMENT SYSTEM USING ORACLE.
Write a PL/SQL block to check if an employee’s salary is greater than 3000.
(IF Statement)
Write a PL/SQL block to check whether a number is positive or negative.
(IF-ELSE Statement)
Write a PL/SQL block to compare two numbers and display the greater one.
(IF-ELSE Statement)
Write a PL/SQL block to check whether a student passed (marks ≥ 40) or failed.
(IF-ELSE Statement)
Write a PL/SQL block to check if salary is above average (use fixed value).
(IF-ELSE Statement)
Write a PL/SQL block to assign grades based on marks:
* ≥ 80 → A
* ≥ 60 → B
* ≥ 40 → C
* else → Fail
(IF-ELSIF-ELSE)
Write a PL/SQL block to check if a number is:
* Positive
* Negative
* Zero
(IF-ELSIF-ELSE)
Write a PL/SQL block to categorize salary:
* High (>5000)
* Medium (3000–5000)
* Low (<3000)
(IF-ELSIF-ELSE)
Write a PL/SQL block using CASE to display day of week based on number (1–7).
(CASE Statement)
Write a PL/SQL block using CASE to check whether a number is even or odd.
(CASE Statement)
Write a PL/SQL block using CASE to display department name based on department id.
(CASE Statement)
Write a PL/SQL block using CASE to categorize salary (High/Medium/Low).
(CASE Statement)
Write a PL/SQL block to print numbers from 1 to 10 but skip number 5 using CONTINUE.
(CONTINUE Statement)
Write a PL/SQL block to display only odd numbers between 1 and 20 using CONTINUE.
(CONTINUE Statement)
Write a PL/SQL block to skip multiples of 3 while printing numbers 1–15.
(CONTINUE Statement)
Write a PL/SQL block to skip employees with salary less than 2000 (use loop).
(CONTINUE Statement)
Write a PL/SQL block to print numbers until sum exceeds 50, then exit.
(EXIT Statement)
Write a PL/SQL block to exit loop when a negative number is encountered.
(EXIT Statement)
Write a PL/SQL block using EXIT WHEN to stop loop when condition is met.
(EXIT Statement)
Write a PL/SQL block to process employee salaries using LOOP, CONTINUE, and EXIT.
(Combined Concepts)
Write a PL/SQL block to simulate a login system (check username & password using IF-ELSE).
(IF-ELSE Practical)