PL SQL Objective Questions 1
What is the name of the cursor written and maintained by a database user?
- User cursor
- Explicit cursor
- Implicit cursor
- User-defined cursor
Ans : 2
What is the syntax of an implicit cursor attribute ISOPEN?
- %ISOPEN
- #ISOPEN
- &ISOPEN
- ! ISOPEN
Ans : 1
What does %FOUND attribute indicate?
- It indicates that the cursor was found.
- It indicates that the number of rows that got affected.
- It indicates whether any rows were affected.
- It indicates whether any rows were not affected.
Ans : 3
When is an implicit cursor used?
- SELECT or DML statement is run and not associated with any cursor variable.
- SELECT statement is run even if the statements are associated with explicit cursor.
- DDL statement is run and the statements are not associated with any explicit cursor.
- SELECT/DML statement is run and the statements are not associated explicit cursor.
Ans : 4
Which type of cursor does an implicit and explicit cursor belong to?
- System cursor
- Session cursor
- Database cursor
- Operating System cursor
Ans : 2
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
Which of the operations of a cursor checks for the validity of a SQL statement?
- OPEN
- BIND
- FETCH
- PARSE
Ans : 4
How many rows can a cursor hold?
- One only
- Zero only
- One or more
- One to ten
Ans : 3
Which of the following is not correct about Cursor ?
- Cursor is a named Private SQL area
- Cursor holds temporary results
- Cursor is used for retrieving multiple rows
- SQL uses implicit Cursors to retrieve rows
Ans : 3
Find the ODD one out of the following
- OPEN
- CLOSE
- INSERT
- FETCH
Ans : 3
What does a COMMIT statement do to a CURSOR?
- Open the Cursor
- Fetch the Cursor
- Close the Cursor
- None of the above
Ans : 4
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
Which of the following statements is true about implicit cursors?
- Implicit cursors are used for SQL statements that are not named.
- Developers should use implicit cursors with great care.
- Implicit cursors are used in cursor for loops to handle data processing.
- Implicit cursors are no longer a feature in Oracle.
Ans : 1
Which of the following is not a feature of a cursor FOR loop?
- Record type declaration.
- Opening and parsing of SQL statements.
- Fetches records from cursor.
- Requires exit condition to be defined.
Ans : 2
When should a CLOSE statement be used in PL/SQL?
- For both implicit and explicit cursors
- Only for explicit cursors
- Only for implicit cursors
- Only for cursor expression
Ans : 2
What can the value of the INTO clause be while fetching data in an explicit cursor?
- PL/SQL scalar variables only
- PL/SQL variables or records
- Collections or records only
- Records only
Ans : 2
Which of the false statements about opening and closing an explicit cursor ?
- An explicit cursor is closed with the CLOSE statement.
- A cursor once closed cannot be re-opened.
- Open statement identifies the result set and positions the cursor before the first row
- Optionally arguments can be passed to the open statement to open a cursor
Ans : 2
What is the datatype of the return value of SQL%ROWCOUNT attribute?
- INTEGER
- NUMBER
- PLS_INTEGER
- BOOLEAN
Ans : 3
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
When should a column fetched in an explicit cursor have an alias?
- An alias should never be used
- Always an alias should be used for columns in an explicit cursor
- Query includes a virtual column or an expression and that is referenced in the query
- The cursor is used to fetch into a record that was declared with %ROWTYPE
Ans : 3
Which of the following statements about a cursor declaration and definition is true?
- An explicit cursor should be declared & defined at the same time in execution block.
- An explicit cursor can be declared first and then defined later
- An explicit cursor should be declared & defined at the same time in declarationblock.
- Cursor declaration and definition are the same and is a single step
Ans : 2
What is the value of %ROWCOUNT before the first row is fetched?
- 1
- Zero
- -1
- NULL
Ans : 2
Which SQL Attribute can be used to determine the exit condition of the loop ?
- %FOUND
- %ISOPEN
- %ROWCOUNT
- %NOTFOUND
Ans : 4
What is the scope of the index of the CURSOR FOR LOOP?
- Local to the loop
- Global
- Local to the loop and enclosing loops
- Block scope (in the entire Pl/SQL block)
Ans : 1
Attend Free Demo and Learn SQL SERVER ONLINE TRAINING by Real-Time Expert
Why is the WHERE CURRENT OF CLAUSE used in Cursors?
- User to easily make changes to the least recently fetched row of data.
- User to easily make changes to all the rows of a table.
- User to easily make changes to the most recently fetched row of data.
- User to easily make changes to the data not fetched by the recent query.
Ans : 3
What is an implicit CURSOR FOR LOOP statement?
- SELECT statement specified outside the CURSOR FOR LOOP statement.
- Cursor specified in the CURSOR FOR LOOP statement.
- Cursor specified in any LOOP statement.
- SELECT statement specified inside the CURSOR FOR LOOP statement.
Ans : 4
Read More PL/SQL Objective Questions and Answers