PL/SQL Cursor Knowledge Quiz
Test your knowledge of PL/SQL cursors. Please answer all questions to the best of your ability.
Full Name
*
First Name
Last Name
Email Address
*
example@example.com
1. What is a cursor in PL/SQL?
*
A pointer to a result set of a query
A type of loop
A variable to store numbers
A database trigger
2. Which of the following are types of cursors in PL/SQL? (Select all that apply)
*
Implicit cursor
Explicit cursor
Global cursor
Temporary cursor
To declare an explicit cursor in PL/SQL, use the syntax: CURSOR
Cursor Name
IS SELECT ...;
4. Match the cursor attribute to its description.
*
Rows
Attribute
Description
A. Returns TRUE if the last fetch returned a row
%FOUND
%NOTFOUND
%ROWCOUNT
%ISOPEN
Returns TRUE if the last fetch returned a row
Returns TRUE if the cursor is open
Returns the number of rows fetched so far
Returns TRUE if the last fetch did not return a row
B. Returns TRUE if the cursor is open
%FOUND
%NOTFOUND
%ROWCOUNT
%ISOPEN
Returns TRUE if the last fetch returned a row
Returns TRUE if the cursor is open
Returns the number of rows fetched so far
Returns TRUE if the last fetch did not return a row
C. Returns the number of rows fetched so far
%FOUND
%NOTFOUND
%ROWCOUNT
%ISOPEN
Returns TRUE if the last fetch returned a row
Returns TRUE if the cursor is open
Returns the number of rows fetched so far
Returns TRUE if the last fetch did not return a row
D. Returns TRUE if the last fetch did not return a row
%FOUND
%NOTFOUND
%ROWCOUNT
%ISOPEN
Returns TRUE if the last fetch returned a row
Returns TRUE if the cursor is open
Returns the number of rows fetched so far
Returns TRUE if the last fetch did not return a row
5. When is an implicit cursor used in PL/SQL?
*
When a SELECT INTO statement is executed
When a cursor is declared by the user
When a trigger is fired
When a procedure is created
6. Select all correct steps in using an explicit cursor.
*
Declare the cursor
Open the cursor
Fetch data from the cursor
Close the cursor
7. What happens if you fetch from a closed cursor?
*
An exception is raised
The fetch succeeds with no data
The cursor is reopened automatically
Nothing happens
8. Please rate your confidence in using PL/SQL cursors.
1
2
3
4
5
9. Briefly describe a scenario where using an explicit cursor is preferred over an implicit cursor.
10. Which of the following statements about cursor FOR loops are true? (Select all that apply)
*
Automatically opens and closes the cursor
Requires explicit fetch statements
Simplifies code for processing query results
Can only be used with implicit cursors
Submit Quiz
Should be Empty: