Professional Documents
Culture Documents
Cursor For Loops PDF
Cursor For Loops PDF
Correct
2. You have declared a cursor as follows:
CURSOR loc_curs IS SELECT * FROM locations;
How should you code a FOR loop to use this cursor?
Mark for Review
(1) Points
Correct
3. Look at the following code:
DECLARE
CURSOR emp_cursor IS SELECT * FROM employees;
BEGIN
FOR emp_record IN emp_cursor LOOP
DBMS_OUTPUT.PUT_LINE( --Point A -- );
END LOOP;
END;
To display the salary of an employee, what code should you write at Point A?
Mark for Review
(1) Points
emp_record.salary (*)
emp_cursor.salary
employees.salary
emp_record.employees.salary
TO_CHAR(salary)
Correct
4. Which one of the following is a valid cursor FOR loop with a subquery?
Mark for Review
(1) Points
Correct
5. A cursor FOR loop using a subquery can extensively shorten code length
when compared to an explicit cursor declaration. True or False? Mark for Review
(1) Points
True (*)
False
Correct
6. What is the DISadvantage of using a cursor FOR loop with a subquery?
Mark for Review
(1) Points
Correct
7. Which of the following is a benefit of using a cursor FOR loop?
Mark for Review
(1) Points
The OPEN, CLOSE, FETCH and EXIT from the loop are done automatically. (*
)
You can OPEN the same cursor twice at the same time.
Correct