1Z0-146 · Question #120
Which guidelines should be considered when designing and using cursors in a PL/SQL block? ? (Choose all that apply.)
The correct answer is A. When fetching from a cursor, fetch into a record. B. Use parameters with cursors so that the result set for the cursor is not tied to a specific variable in a E. When using data manipulation language statements, (DML) reference a SQL cursor attribute immediately. The %NOTFOUND attribute is not useful in combination with the SELECT INTO statement: If a SELECT INTO statement fails to return a row, PL/SQL raises the predefined exception NO_DATA_FOUND immediately, interrupting the flow of control before you can check %NOTFOUND. A SELECT…
Question
Which guidelines should be considered when designing and using cursors in a PL/SQL block? ? (Choose all that apply.)
Options
- AWhen fetching from a cursor, fetch into a record.
- BUse parameters with cursors so that the result set for the cursor is not tied to a specific variable in a
- CUse the %NOTFOUND attribute in combination with the SELECT INTO statement to check for non
- DWhenever possible, explicitly declare the cursor and use the OPEN, FETCH and CLOSE statements
- EWhen using data manipulation language statements, (DML) reference a SQL cursor attribute immediately
How the community answered
(25 responses)- A84% (21)
- C8% (2)
- D8% (2)
Explanation
The %NOTFOUND attribute is not useful in combination with the SELECT INTO statement: If a SELECT INTO statement fails to return a row, PL/SQL raises the predefined exception NO_DATA_FOUND immediately, interrupting the flow of control before you can check %NOTFOUND. A SELECT INTO statement that calls a SQL aggregate function always returns a value or a null. After such a statement, the %NOTFOUND attribute is always FALSE, so checking it is
Topics
Community Discussion
No community discussion yet for this question.