Deck 4: Cursors and Exception Handling

Full screen (f)
exit full mode
Question
Implicit and explicit cursors are considered dynamic because they are associated with specific queries.
Use Space or
up arrow
down arrow
to flip the card.
Question
A cursor variable assigns a name to a work area holding a specific result set, whereas an explicit cursor is simply a pointer to a work area in which a query can be processed.
Question
In PL/SQL, comment text is not executed.
Question
A FORALL statement can process a group of rows in a DML operation.
Question
Bulk processing options can have a detrimental effect on performance.
Question
In Oracle, if the UPDATE statement does not affect any rows, an error is raised.
Question
Some cursor variables are references or pointers to a specific work area.
Question
Explicit cursors are declared automatically for all DML and SELECT statements issued within a PL/SQL block.
Question
You can process multiple rows of data from a database by creating explicit cursors.
Question
Implicit cursors are considered static because they are associated with specific queries. _________________________
Question
Three arguments are required in a PRAGMA EXCEPTION_INIT statement.
Question
When referencing SQL attributes, the attribute information always reflects the information from the most recent SQL statement processed.
Question
An exception is a mechanism to trap an error that occurs in processing.
Question
Implicit cursors are declared and manipulated in the PL/SQL block code for handling a set of rows returned by a SELECT statement. _________________________
Question
If the INTO clause of a SELECT statement contains either scalar or record variables and if more than one row is selected, the TOO_MANY_ROWS error is raised. _________________________
Question
A SELECT statement within a PL/SQL block has the possibility of raising the NO_DATA_FOUND exception.
Question
A(n) PRAGMA statement instructs Oracle to use some additional information provided when compiling and executing a block. _________________________
Question
Implicit cursors are declared and manipulated in the PL/SQL block code for handling a set of rows returned by a SELECT statement.
Question
A(n) EXCEPTION statement within a PL/SQL block has the possibility of raising the NO_DATA_FOUND or TOO_MANY_ROWS exception. _________________________
Question
In PL/SQL, if a SELECT statement returns no rows, Oracle does not return an error.
Question
An error raised in the executable section of a block immediately moves processing to the EXCEPTION section of the block in search of an exception handler. _________________________
Question
The ____ action used in an explicit cursor processes the query and creates an active set of rows available in the cursor.

A) DECLARE
B) OPEN
C) FETCH
D) CLOSE
Question
A(n) ____ represents a work area or section of memory in which an SQL statement is being processed in the Oracle server.

A) collection
B) variable
C) cursor
D) nested table
Question
The ____ action used with an explicit cursor creates a named cursor identified by a SELECT statement.

A) OPEN
B) DECLARE
C) FETCH
D) CLOSE
Question
A(n) ____ is a mechanism to trap an error that occurs in processing.

A) EXCEPTION
B) UPDATE
C) Exception handler
D) GOTO
Question
Because Oracle does not raise an error if a(n) UPDATE does not affect any rows, you must include specific instructions in the block to raise an error if no rows are updated. _________________________
Question
____ are declared and manipulated in the PL/SQL block code for handling a set of rows returned by a SELECT statement.

A) Implicit cursors
B) Collections
C) Index-by tables
D) Explicit cursors
Question
____ are values passed into the cursor when opened and used in the SELECT statement of the cursor to determine what value it will contain.

A) Collections
B) Subqueries
C) Parameters
D) Variables
Question
____ refers to a SELECT statement in a PL/SQL block that retrieves more than one row.

A) NO_DATA_FOUND
B) ZERO_DIVIDE
C) CASE_NOT_FOUND
D) TOO_MANY_ROWS
Question
The RAISE_APPLICATION_ERROR is an Oracle built-in procedure that allows the developer to associate their own error number and message to an error. _________________________
Question
____ are declared automatically for DML and SELECT statements issued within a PL/SQL block.

A) Implicit cursors
B) Index-by Tables
C) Assignment statements
D) Collections
Question
Oracle supplies a set of ____ or names associated with common Oracle errors.

A) predefined exceptions
B) looping constructs
C) exception handlers
D) Searched CASES
Question
What can be used to simplify processing each row of a set retrieved from a database?

A) CURSOR
B) CURSOR For LOOP
C) LOOP
D) CURSOR Attribute
Question
____ refers to a SELECT statement in a PL/SQL block that retrieves no rows.

A) TOO_MANY_ROWS
B) NO_DATA_FOUND
C) ZERO_DIVIDE
D) DUP_VAL_ON_INDEX
Question
An exception that has been declared must be referred to in the RAISE statement or a PL/SQL error will occur. _________________________
Question
The ____ section of a PL/SQL block addresses two situations: either an Oracle error is raised or a user-defined error is raised.

A) DECLARE
B) BEGIN
C) EXCEPTION
D) UPDATE
Question
The SQLCODE function returns the Oracle error message. _________________________
Question
The SQLERRM function returns the Oracle error number. _________________________
Question
____ refers to a condition where there is no WHEN clause in the CASE statement.

A) CASE_NOT_FOUND
B) ZERO_DIVIDE
C) DUP_VAL_ON_INDEX
D) NO_DATA_FOUND
Question
The ____ action used with an explicit cursor clears the active set of rows and frees the memory area used for the cursor.

A) CLOSE
B) OPEN
C) DECLARE
D) FETCH
Question
A(n) ____________________ is one that a developer explicitly raises in the block to enforce a business rule.
Question
The ____ option groups rows of queries or DML statements for processing.

A) FORALL
B) COLLECT BULK
C) BULK COLLECT
D) LIMIT
Question
Which of the following statements is correct?

A) The value of the SQLCODE can be used directly in an SQL statement.
B) The value of the SQLCODE is assigned to a variable.
C) The value of the SQLCODE can not be assigned to a variable.
D) The value of the SQLERRM can be used directly in an SQL statement.
Question
____ refers to an attempted violation of a unique or primary key column constraint.

A) NO_DATA_FOUND
B) TOO_MANY_ROWS
C) DUP_VAL_ON_INDEX
D) CASE_NOT_FOUND
Question
The ____ handler should always be the last handler listed in the EXCEPTION section of a block.

A) TOO_MANY_ROWS
B) NO_DATA_FOUND
C) EXIT WHEN
D) WHEN OTHERS
Question
If the ____________________ clause of a SELECT statement contains either scalar or record variables and if more than one row is selected, the TOO_MANY_ROWS error is raised.
Question
____ is required in a PRAGMA EXCEPTION_INIT statement.

A) LOOP
B) Exception name
C) Predefined error
D) INIT code
Question
An attempted violation of a unique or primary key column constraint causes the ____________________ exception.
Question
Which of the following statements is correct?

A) An exception that has been declared must be referred to in the RAISE statement, or a PL/SQL error will occur.
B) An exception that has not been declared must be referred to in the RAISE statement, or a PL/SQL error will occur.
C) An exception that has been declared must not be referred to in the RAISE statement, or a PL/SQL error will occur.
D) An exception that has been declared must be referred to in the SELECT statement, or a PL/SQL error will occur.
Question
Predefined exceptions are declared in the ____________________ package, which makes these globally available on the system.
Question
Because Oracle does not raise an error if a(n) ____________________ does not affect any rows, you must include specific instructions in the block.
Question
The ____ option specifies the number of rows to process as a group.

A) FORALL
B) NUMROWS
C) BULK COLLECT
D) LIMIT
Question
____ has the possibility of raising the NO_DATA_FOUND or TOO_MANY_ROWS exception.

A) DECLARE
B) SELECT
C) CASE
D) LOOP
Question
A(n) ____ is one that a developer explicitly raises in the block to enforce a business rule.

A) predefined exception
B) exception
C) user-defined exception
D) error
Question
____ is used to trap errors not specifically addressed in one of the exception handlers.

A) WHERE
B) EXIT WHEN
C) WHEN OTHERS
D) EXCEPTION
Question
____ returns the Oracle error message.

A) EXIT WHEN
B) SQLCODE
C) SQLERR
D) SQLERRM
Question
A(n) ____________________ statement within a PL/SQL block has the possibility of raising the NO_DATA_FOUND or TOO_MANY_ROWS exception.
Question
An attempted division by zero causes the ____________________ exception.
Question
The ____ is an Oracle built-in procedure that allows developers to associate their own error number and message to an error.

A) SQLCODE
B) SQLERRM
C) RAISE_APPLICATION_ERROR
D) WHEN OTHERS
Question
The ____________________ function returns the Oracle error number.
Question
A good programming practice is to include ____________________ in your code to document what is being accomplished throughout the program.
Question
What is the difference between an explicit and an implicit cursor?
Question
When processing many rows in a query, ____________________ can be used to improve performance.
Question
What is the difference between a predefined exception and a user-defined exception?
Question
Discuss the meaning of the term exception handler.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/65
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 4: Cursors and Exception Handling
1
Implicit and explicit cursors are considered dynamic because they are associated with specific queries.
False
2
A cursor variable assigns a name to a work area holding a specific result set, whereas an explicit cursor is simply a pointer to a work area in which a query can be processed.
False
3
In PL/SQL, comment text is not executed.
True
4
A FORALL statement can process a group of rows in a DML operation.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
5
Bulk processing options can have a detrimental effect on performance.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
6
In Oracle, if the UPDATE statement does not affect any rows, an error is raised.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
7
Some cursor variables are references or pointers to a specific work area.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
8
Explicit cursors are declared automatically for all DML and SELECT statements issued within a PL/SQL block.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
9
You can process multiple rows of data from a database by creating explicit cursors.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
10
Implicit cursors are considered static because they are associated with specific queries. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
11
Three arguments are required in a PRAGMA EXCEPTION_INIT statement.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
12
When referencing SQL attributes, the attribute information always reflects the information from the most recent SQL statement processed.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
13
An exception is a mechanism to trap an error that occurs in processing.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
14
Implicit cursors are declared and manipulated in the PL/SQL block code for handling a set of rows returned by a SELECT statement. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
15
If the INTO clause of a SELECT statement contains either scalar or record variables and if more than one row is selected, the TOO_MANY_ROWS error is raised. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
16
A SELECT statement within a PL/SQL block has the possibility of raising the NO_DATA_FOUND exception.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
17
A(n) PRAGMA statement instructs Oracle to use some additional information provided when compiling and executing a block. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
18
Implicit cursors are declared and manipulated in the PL/SQL block code for handling a set of rows returned by a SELECT statement.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
19
A(n) EXCEPTION statement within a PL/SQL block has the possibility of raising the NO_DATA_FOUND or TOO_MANY_ROWS exception. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
20
In PL/SQL, if a SELECT statement returns no rows, Oracle does not return an error.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
21
An error raised in the executable section of a block immediately moves processing to the EXCEPTION section of the block in search of an exception handler. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
22
The ____ action used in an explicit cursor processes the query and creates an active set of rows available in the cursor.

A) DECLARE
B) OPEN
C) FETCH
D) CLOSE
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
23
A(n) ____ represents a work area or section of memory in which an SQL statement is being processed in the Oracle server.

A) collection
B) variable
C) cursor
D) nested table
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
24
The ____ action used with an explicit cursor creates a named cursor identified by a SELECT statement.

A) OPEN
B) DECLARE
C) FETCH
D) CLOSE
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
25
A(n) ____ is a mechanism to trap an error that occurs in processing.

A) EXCEPTION
B) UPDATE
C) Exception handler
D) GOTO
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
26
Because Oracle does not raise an error if a(n) UPDATE does not affect any rows, you must include specific instructions in the block to raise an error if no rows are updated. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
27
____ are declared and manipulated in the PL/SQL block code for handling a set of rows returned by a SELECT statement.

A) Implicit cursors
B) Collections
C) Index-by tables
D) Explicit cursors
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
28
____ are values passed into the cursor when opened and used in the SELECT statement of the cursor to determine what value it will contain.

A) Collections
B) Subqueries
C) Parameters
D) Variables
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
29
____ refers to a SELECT statement in a PL/SQL block that retrieves more than one row.

A) NO_DATA_FOUND
B) ZERO_DIVIDE
C) CASE_NOT_FOUND
D) TOO_MANY_ROWS
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
30
The RAISE_APPLICATION_ERROR is an Oracle built-in procedure that allows the developer to associate their own error number and message to an error. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
31
____ are declared automatically for DML and SELECT statements issued within a PL/SQL block.

A) Implicit cursors
B) Index-by Tables
C) Assignment statements
D) Collections
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
32
Oracle supplies a set of ____ or names associated with common Oracle errors.

A) predefined exceptions
B) looping constructs
C) exception handlers
D) Searched CASES
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
33
What can be used to simplify processing each row of a set retrieved from a database?

A) CURSOR
B) CURSOR For LOOP
C) LOOP
D) CURSOR Attribute
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
34
____ refers to a SELECT statement in a PL/SQL block that retrieves no rows.

A) TOO_MANY_ROWS
B) NO_DATA_FOUND
C) ZERO_DIVIDE
D) DUP_VAL_ON_INDEX
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
35
An exception that has been declared must be referred to in the RAISE statement or a PL/SQL error will occur. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
36
The ____ section of a PL/SQL block addresses two situations: either an Oracle error is raised or a user-defined error is raised.

A) DECLARE
B) BEGIN
C) EXCEPTION
D) UPDATE
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
37
The SQLCODE function returns the Oracle error message. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
38
The SQLERRM function returns the Oracle error number. _________________________
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
39
____ refers to a condition where there is no WHEN clause in the CASE statement.

A) CASE_NOT_FOUND
B) ZERO_DIVIDE
C) DUP_VAL_ON_INDEX
D) NO_DATA_FOUND
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ action used with an explicit cursor clears the active set of rows and frees the memory area used for the cursor.

A) CLOSE
B) OPEN
C) DECLARE
D) FETCH
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
41
A(n) ____________________ is one that a developer explicitly raises in the block to enforce a business rule.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
42
The ____ option groups rows of queries or DML statements for processing.

A) FORALL
B) COLLECT BULK
C) BULK COLLECT
D) LIMIT
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
43
Which of the following statements is correct?

A) The value of the SQLCODE can be used directly in an SQL statement.
B) The value of the SQLCODE is assigned to a variable.
C) The value of the SQLCODE can not be assigned to a variable.
D) The value of the SQLERRM can be used directly in an SQL statement.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
44
____ refers to an attempted violation of a unique or primary key column constraint.

A) NO_DATA_FOUND
B) TOO_MANY_ROWS
C) DUP_VAL_ON_INDEX
D) CASE_NOT_FOUND
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
45
The ____ handler should always be the last handler listed in the EXCEPTION section of a block.

A) TOO_MANY_ROWS
B) NO_DATA_FOUND
C) EXIT WHEN
D) WHEN OTHERS
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
46
If the ____________________ clause of a SELECT statement contains either scalar or record variables and if more than one row is selected, the TOO_MANY_ROWS error is raised.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
47
____ is required in a PRAGMA EXCEPTION_INIT statement.

A) LOOP
B) Exception name
C) Predefined error
D) INIT code
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
48
An attempted violation of a unique or primary key column constraint causes the ____________________ exception.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
49
Which of the following statements is correct?

A) An exception that has been declared must be referred to in the RAISE statement, or a PL/SQL error will occur.
B) An exception that has not been declared must be referred to in the RAISE statement, or a PL/SQL error will occur.
C) An exception that has been declared must not be referred to in the RAISE statement, or a PL/SQL error will occur.
D) An exception that has been declared must be referred to in the SELECT statement, or a PL/SQL error will occur.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
50
Predefined exceptions are declared in the ____________________ package, which makes these globally available on the system.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
51
Because Oracle does not raise an error if a(n) ____________________ does not affect any rows, you must include specific instructions in the block.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
52
The ____ option specifies the number of rows to process as a group.

A) FORALL
B) NUMROWS
C) BULK COLLECT
D) LIMIT
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
53
____ has the possibility of raising the NO_DATA_FOUND or TOO_MANY_ROWS exception.

A) DECLARE
B) SELECT
C) CASE
D) LOOP
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
54
A(n) ____ is one that a developer explicitly raises in the block to enforce a business rule.

A) predefined exception
B) exception
C) user-defined exception
D) error
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
55
____ is used to trap errors not specifically addressed in one of the exception handlers.

A) WHERE
B) EXIT WHEN
C) WHEN OTHERS
D) EXCEPTION
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
56
____ returns the Oracle error message.

A) EXIT WHEN
B) SQLCODE
C) SQLERR
D) SQLERRM
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
57
A(n) ____________________ statement within a PL/SQL block has the possibility of raising the NO_DATA_FOUND or TOO_MANY_ROWS exception.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
58
An attempted division by zero causes the ____________________ exception.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
59
The ____ is an Oracle built-in procedure that allows developers to associate their own error number and message to an error.

A) SQLCODE
B) SQLERRM
C) RAISE_APPLICATION_ERROR
D) WHEN OTHERS
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
60
The ____________________ function returns the Oracle error number.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
61
A good programming practice is to include ____________________ in your code to document what is being accomplished throughout the program.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
62
What is the difference between an explicit and an implicit cursor?
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
63
When processing many rows in a query, ____________________ can be used to improve performance.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
64
What is the difference between a predefined exception and a user-defined exception?
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
65
Discuss the meaning of the term exception handler.
Unlock Deck
Unlock for access to all 65 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 65 flashcards in this deck.