Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q171: Fill in the blank: The attribute _______ returns TRUE if the cursor is open.
- A: %ISOPEN
- B: %FOUND
- C: %ROWCOUNT
- D: %NOTFOUND
View Answer
A
Q172: What does the PL/SQL block in "Processing Explicit Cursor –VI" do?
- A: Displays names and jobs of clerks with a manager number greater than 120
- B: Updates salaries for employees with a manager number greater than 120
- C: Inserts data into a temp table if the sum of salaries exceeds 20000
- D: Displays the bottom 4 salaries from the employee table
View Answer
A
Q173: In which processing example is a cursor used to insert rows into a temp table based on the sum of salaries?
- A: Processing Explicit Cursor –V
- B: Processing Explicit Cursor –VI
- C: Processing Explicit Cursor with SQL–I
- D: Processing Explicit Cursor with SQL–II
View Answer
D
Q174: What is the primary purpose of handling exceptions in PL/SQL?
- A: Avoid program termination
- B: Optimize code performance
- C: Increase database security
- D: Reduce syntax errors
View Answer
A
Q175: Which of the following is an example of an internal exception in PL/SQL?
- A: No Data Found
- B: Duplicate Value
- C: Invalid Number
- D: Zero Division Error
View Answer
A
Q176: What does the `WHEN others` clause in an exception block handle?
- A: Specific exceptions
- B: User-defined exceptions
- C: All exceptions not explicitly handled
- D: Internal exceptions
View Answer
C
Q177: In PL/SQL, what must a user-defined exception be explicitly raised with?
- A: EXCEPTION block
- B: Raise statement
- C: BEGIN block
- D: THEN statement
View Answer
B
Q178: Which section of a PL/SQL block contains executable statements?
- A: Exception Section
- B: Declare Section
- C: Begin Section
- D: End Section
View Answer
C
Q179: What will the output be if a `SELECT` statement in PL/SQL returns more than one row?
- A: Record not matched
- B: Unique Key Violated
- C: ORA-01422: exact fetch returns more than requested number of rows
- D: Invalid Number
View Answer
C
Q180: What does the `SQLERRM` function return in an exception block?
- A: The SQL error code
- B: The error message associated with the exception
- C: The name of the exception
- D: The error description
View Answer
B