Q:
         
         
            
               What are Cursors?  Explain Types of cursors in PL/SQL
            
                      
         
             Answer
                        Cursors help you manipulate the information retrieved by select statements. This can be done by assigning a name to the cursor.
Example:
CURSOR emp_cur 
IS 
SELECT emp_number from employee_tbl where employee_name = name_in;
Types of Cursors:
Implicit cursors- These cursors are not declared by the programmer. They are issued when the SQL statement is executed. The open, close and fetching is done by itself.
Example:
UPDATE employee SET salary = salary * 2.1;
Here, an implicit cursor is issued to identify the set of rows in the table which would be affected by the update.
 
Explicit cursors- These cursors are defined by programmer. They are used in queries that return multiple rows.
Example:
CURSOR emp_cur 
IS 
SELECT emp_number from employee_tbl where employee_name = name_in;
          
         
         
         
             View answer
             Workspace
             Report Error
             Discuss