Which statements are true about the WHEN OTHERS exception handler? (Choose all that apply)
A.
It can be the first exception handler.
B.
It can be the only exception handler for the code.
C.
It traps all the exceptions that are not already trapped.
D.
You can have multiple OTHERS clauses to trap all the multiple unhandled exceptions.
Explanation:
http://www.techonthenet.com/oracle/exceptions/when_others.php
B C
a) wrong, it can’t, oracle will throw an exception
b) true, we can have only one exception handler for the code
c) true, it intended for it
d) wrong, it can’t, oracle will throw an exception
a) wrong, if we have several exceptions
B C
B C
BC
C only. Code can have other exception handlers such as DUP_VAL_ON_INDEX.
It “can be”, not “must be”.
Both B and C are correct answers.
CREATE [OR REPLACE] PROCEDURE procedure_name
IS [declaration_section]
BEGIN
EXCEPTION
WHEN exception_name1 THEN [statements]
WHEN exception_name2 THEN [statements]
WHEN exception_name_n THEN [statements]
WHEN OTHERS THEN [statements]
END [procedure_name];
Handle named exceptions whenever possible, instead of using WHEN OTHERS in exception handlers.
B and C are true.
WHEN OTHERS will traps all the exceptions that are not already trapped.
WHEN OTHERS can be the ONLY exception handler
==============================================================
DECLARE emp_rec employee%ROWTYPE;
BEGIN
SELECT * INTO emp_rec FROM employee where id=909888;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(‘This is the only exception handler!!’);
END;
OUTPUT:
PL/SQL procedure successfully completed.
This is the only exception handler!!
Excuse my particularity, but what exactly prevents OTHERS to be the first exception handler if it’s the only exception handler? A being correct immediatly follows from B being correct.
it is B,C
for certification purpose you can choose
C – radio button option
B,C – for check box
BC
A wrong..
SQL> declare
2 x number;
3 y number;
4 begin
5 x:=0;
6 y:=1/x;
7 null;
8 EXCEPTION
9 when OTHERS then
10 dbms_output.put_line(‘unsuccess’);
11 when ZERO_DIVIDE then
12 dbms_output.put_line(‘Success’);
13 end;
14 /
when OTHERS then
*
ERROR at line 9:
ORA-06550: line 9, column 1:
PLS-00370: OTHERS handler must be last among the exception handlers of a block
ORA-06550: line 0, column 0:
PL/SQL: Compilation unit analysis terminated
I agree with B & C, just a question about A. If B is right, and WHEN OTHER is the only exception handler in the code, then it is also the first exception handler in the code, in this situation, A is also right.
only C.
WHEN OTHERS Exception Handler
The exception-handling section traps only those exceptions that are specified; any other exceptions are not trapped unless you use the OTHERS exception handler. This traps any exception not yet handled. For this reason, OTHERS may be used, and if used it must be the last exception handler that is defined.
WHEN NO_DATA_FOUND THEN statement1; …WHEN TOO_MANY_ROWS THEN statement1; … WHEN OTHERS THEN statement1;
Consider the preceding example. If the NO_DATA_FOUND exception is raised by the program, the statements in the corresponding handler are executed. If the TOO_MANY_ROWS exception is raised, the statements in the corresponding handler are executed. However, if some other exception is raised, the statements in the OTHERS exception handler are executed.
The OTHERS handler traps all the exceptions that are not already trapped. Some Oracle tools have their own predefined exceptions that you can raise to cause events in the application. The OTHERS handler also traps these exceptions.
Here are a few of the internet sites we advocate for our visitors.
Wonderful story, reckoned we could combine a handful of unrelated data, nevertheless truly really worth taking a search, whoa did one particular find out about Mid East has got a lot more problerms as well
check below, are some completely unrelated websites to ours, nonetheless, they’re most trustworthy sources that we use
usually posts some incredibly exciting stuff like this. If you are new to this site
below youll uncover the link to some web-sites that we feel you ought to visit
one of our guests not too long ago advised the following website
Here are a few of the websites we advocate for our visitors
one of our guests just lately suggested the following website
although web sites we backlink to below are considerably not connected to ours, we really feel they’re truly really worth a go by, so have a look
although internet sites we backlink to beneath are considerably not related to ours, we feel they’re really really worth a go via, so possess a look
we came across a cool site which you may well get pleasure from. Take a look if you want
Every when in a whilst we decide on blogs that we read. Listed below would be the most current internet sites that we pick out
Very nice article, exactly what I wanted to find.|
12/23/2016 @ 18:59:24 Appreciate aiotestking.com– very informative and a lot of stuff to explore!
https://tonsilstonesauthority.wordpress.com/
bc
That is the best search engine in the world
http://google.com