View Exhibit1 and examine the structure of the EMP table.
View Exhibit2 and examine the code created by the user SCOTT:
SCOTT grants the necessary privileges to green to access the EMP table and execute the
package.
Examine the following sequence of activities:
SCOTT starts a session and issues the SQL>EXEC CURS_PKG.OPEN command.
SCOTT then issues the SQL>EXEC CURS_PKG.NEXT command.
green starts a session while SCOTT’s session is running and issues THE SQL>EXEC
CURS_PKG.NEXT command.
SCOTT issues the SQI>>EXEC SCOTT.CURS_PKG.NEXT command.
The EMP table contains sequential EMPNOS from 100 through 108.
Which statement correctly describes the output?
A.
SCOTT’s session shows the EMPNO 100, GREEN’S session shows an error, and SCOTT’s
session shows an error.
B.
SCOTT’s session shows the EMPNO 100, GREEN’S session shows EMPNO 100, and
SCOTT’s session shows the EMPNO 101.
C.
SCOTT’s session shows the EMPNO 100, GREEN’S session shows an error, and SCOTT’s
session shows the second EMPNO 101.
D.
SCOTT’s session shows the EMPNO 100, GREEN’S session shows EMPNO 101, and
SCOTT’s session shows the second EMPNO 102.
C, green didnt open cursor
C
c
C
PL/SQL raises the predefined exception INVALID_CURSOR if you try to fetch from a closed or never-opened cursor or cursor variable.
The whole point of using a sequence is that different sessions will get different non-repeating values without blocking each other. Each session should see a different CURRVAL.
Green did not open the cursor first therefore Green gets an error accessing the cursor
Oracle/PLSQL OPEN statement:
Once you’ve declared your cursor, the next step is to use the OPEN statement to open the cursor.
SYNTAX
The syntax to open a cursor using the OPEN statement in Oracle/PLSQL is:
OPEN cursor_name;
C