Unformatted text preview: able would be local to each procedure and this would prevent the variable
from being shared.
QUESTION 86: Examine this package:
CREATE OR REPLACE PACKAGE pack_cur
CURSOR c1 IS
ORDER BY Prodid DESC;
CREATE OR REPLACE PACKAGE BODY pack_cur
PROCEDURE proc1 IS
FETCH c1 INTO V_prodid;
DBMS_OUTPUT.PUT_LINE('Row is ;'||C1% ROWCOUNT);
EXIT WHEN C1% ROWCOUNT>=3;
PROCEDURE proc2 IS
FETCH C1 INTO v_prodid;
DBMS_OUTPUT-PUT_LINE ( ' Row is: ' ll c1 %ROWCOUNT);
EXIT WHEN C1%ROWCOUNT >= 3;
The product table has more than 1000 rows. The SQL*Plus SERVEROUTPUT
setting is turned on in your session.
You execute the procedure PROC1 from SQL *Plus with the command:
EXECUTE pack_cur. PROC1;
You then execute the procedure PROC2 from SQL *Plus with the
EXECUTE pack_cur. PROC2;
What is the output in your session from the PROC2 procedure?
Actualtests.com - The Power of Knowing 1Z0-147 A. ERROR at line 1:
B. Row is:
C. Row is: 1
Row is: 2
Row is: 3
D. Row is: 4
Row is: 5
Row is: 6
In the above example, the first procedure is used to fetch the first three rows, and the
second procedure is used to fetch the next three rows from the product table. cursors
declared in the package specification are persistent and retain their status across the user
session. The persistent state of the cursor refers to the rule that you can open a cursor in
one block, fetch the rows in another block, and close the cursor in yet another block.
A. This would execute successfully and would not generate an error.
B. The DBMS_OUTPUT.PUT_LINE will include the value of the ROWCOUNT of the
C. The ROWCOUNT is 3 when PROC1 finishes executing. Since the cursor state is
persistent when the PCOC2 procedure executes the next row fetched on ROW 4. The
LOOP exits when after it fetches the...
View Full Document
This document was uploaded on 03/08/2014.
- Fall '09