Which statement is true about the exception handlers in the PL/SQL code?

View the exhibit to examine the PL/SQL code.

Which statement is true about the exception handlers in the PL/SQL code?

View the exhibit to examine the PL/SQL code.

Which statement is true about the exception handlers in the PL/SQL code?

A.
All the exceptions in the code are trapped by the exception handler.

B.
All the “no data found” errors in the code are trapped by the exception handler.

C.
The PL/SQL program does not execute because an exception is not declared in the declare
section.

D.
An exception handler in the code traps the “no data found” error after executing the handler
code and the program flow returns to the next line of code.



Leave a Reply 7

Your email address will not be published. Required fields are marked *


Tr

Tr

B,

if you run this code:
PL/SQL procedure successfully completed.

NO DATA FOUND FOR SELECT ON emp

Jen

Jen

C: The PL/SQL program does not execute because an exception is not declared in the declare
section. <== THIS IS INCORRECT

declare
temp_var VARCHAR2(10);
emp_var VARCHAR2(20):= 'last name';
begin
temp_var := emp_var;
select JOB_ID into temp_var from employees where employee_id = 21;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE ('NO DATA WAS FOUND');
end;

PL/SQL procedure successfully completed.
NO DATA WAS FOUND

giosefer

giosefer

Confirm, the correct answer is B

renko

renko

Answer: B

set serveroutput on

declare
emp_column varchar2(30) := ‘last_name’;
table_name varchar2(30) := ’emp’;
temp_var varchar2(30);
begin
temp_var := emp_column;
select column_name into temp_var
from user_tab_cols
where table_name = ‘EMPLOYEES’
and column_name = upper(emp_column);

temp_var := table_name;
select object_name into temp_var
from user_objects
where object_name = upper(table_name)
and object_type = ‘TABLE’;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE (‘No Data found for SELECT on ‘|| temp_var);
end;
/
show errors

/*
PL/SQL procedure successfully completed.

No errors.
*/