Which statements are true about the WHEN OTHERS exception handler?

Which statements are true about the WHEN OTHERS exception handler? (Choose all that apply)

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



Leave a Reply 32

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


Vladimir

Vladimir

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

Uladzimir

Uladzimir

a) wrong, if we have several exceptions

dudeman

dudeman

C only. Code can have other exception handlers such as DUP_VAL_ON_INDEX.

Thomas Kyte

Thomas Kyte

It “can be”, not “must be”.
Both B and C are correct answers.

Alisa

Alisa

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];

Alisa

Alisa

Handle named exceptions whenever possible, instead of using WHEN OTHERS in exception handlers.

Jen

Jen

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!!

Correct Asnwero

Correct Asnwero

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.

Sravz

Sravz

it is B,C

for certification purpose you can choose
C – radio button option
B,C – for check box

SK

SK

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

Xinqi

Xinqi

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.

lolo

lolo

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.

Google

Google

Here are a few of the internet sites we advocate for our visitors.

how to create an app for free

how to create an app for free

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

how to make a app

how to make a app

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

how to create an app for free

how to create an app for free

below youll uncover the link to some web-sites that we feel you ought to visit

in home care

in home care

one of our guests not too long ago advised the following website

recipes

recipes

Here are a few of the websites we advocate for our visitors

health benefits of coconut oil

health benefits of coconut oil

one of our guests just lately suggested the following website

Computer Repair

Computer Repair

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

pullulan

pullulan

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

bono apuestas deportivas

bono apuestas deportivas

we came across a cool site which you may well get pleasure from. Take a look if you want

wood phone case

wood phone case

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

Click Webpage

Click Webpage

Very nice article, exactly what I wanted to find.|