nerdexam
Oracle

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…

Design Considerations for PL/SQL Code

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)
  • A
    84% (21)
  • C
    8% (2)
  • D
    8% (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

#cursor design#parameterized cursors#cursor attributes#record fetch

Community Discussion

No community discussion yet for this question.

Full 1Z0-146 Practice