PLSQL: CURSORS, WITH FOR LOOP, PARAMETERISED CURSORS, UPDATABLE CURSORS
30 programming challenges to help you master the fundamentals of DATABASE MANAGEMENT SYSTEM USING ORACLE.
Write a PL/SQL block to declare a cursor to fetch all employees from EMP table and display their names.
(Explicit Cursor)
Write a PL/SQL block to fetch employee name and salary using cursor and display them.
(Explicit Cursor)
Write a PL/SQL block to display employees whose salary is greater than 3000 using cursor.
(Explicit Cursor + Condition)
Write a PL/SQL block to calculate total salary of all employees using cursor.
(Explicit Cursor + Aggregate)
Write a PL/SQL block to fetch records one by one using OPEN, FETCH, and CLOSE.
(Cursor Lifecycle)
Write a PL/SQL block to display all employee records using cursor FOR LOOP.
(Cursor FOR LOOP)
Write a PL/SQL block to display employee names and jobs using cursor FOR LOOP.
(Cursor FOR LOOP)
Write a PL/SQL block to display employees from department 10 using cursor FOR LOOP.
(Cursor FOR LOOP + Condition)
Write a PL/SQL block to calculate total salary using cursor FOR LOOP.
(Cursor FOR LOOP)
Write a PL/SQL block to display employees with salary greater than average using cursor FOR LOOP.
(Cursor FOR LOOP + Subquery)
Write a PL/SQL block to declare a parameterized cursor that takes department number and displays employees of that department.
(Parameterized Cursor)
Write a PL/SQL block to fetch employees whose salary is greater than a given value using parameterized cursor.
(Parameterized Cursor)
Write a PL/SQL block to display employees based on job role using parameterized cursor.
(Parameterized Cursor)
Write a PL/SQL block to calculate total salary of a given department using parameterized cursor.
(Parameterized Cursor + Aggregate)
Write a PL/SQL block to pass multiple parameters (deptno, job) to cursor and display matching records.
(Parameterized Cursor)
Write a PL/SQL block to update salary of employees using cursor with FOR UPDATE.
(Updatable Cursor)
Write a PL/SQL block to increase salary by 10% for employees using WHERE CURRENT OF.
(Updatable Cursor)
Write a PL/SQL block to delete employees with salary less than 2000 using cursor.
(Updatable Cursor + DELETE)
Write a PL/SQL block to update job of employees using updatable cursor.
(Updatable Cursor)
Write a PL/SQL block to fetch records using cursor and modify values row-by-row.
(Updatable Cursor)
Write a PL/SQL block using explicit cursor and IF condition to display high salary employees.
(Cursor + IF)
Write a PL/SQL block using cursor FOR LOOP and calculate bonus (10% of salary).
(Cursor FOR LOOP + Calculation)
Write a PL/SQL block using parameterized cursor and loop through multiple departments.
(Parameterized Cursor + LOOP)
Write a PL/SQL block to update and display employee data using updatable cursor.
(Updatable Cursor + Output)
Write a PL/SQL block to display top 3 highest paid employees using cursor.
(Cursor + Logic)
Write a PL/SQL block to simulate pagination (fetch limited rows using cursor).
(Cursor Advanced)
Write a PL/SQL block to copy employee data into another table using cursor.
(Cursor + INSERT)
Write a PL/SQL block to display department-wise employee count using cursor.
(Cursor + Grouping Logic)
Write a PL/SQL block to process employee records and apply different salary increments based on job using cursor.
(Cursor + Business Logic)