Examine the following PL/SQL code:
Which statement is true about the execution of the PL/SQL code?
A.
It executes successfully.
B.
It generates a run-time exception.
C.
It does not execute because of syntax error
D.
It executes successfully and generates a warning.
Explanation:
http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/errors.htm
answer is B
ORA-06512: na linha 8
01476. 00000 – “divisor is equal to zero”
B
B
b
B
the right one is B
create or replace procedure proctest as
stock_price NUMBER := 9.73;
net_earnings NUMBER := 0;
pe_ratio NUMBER;
BEGIN
pe_ratio := stock_price / net_earnings;
DBMS_OUTPUT.PUT_LINE(‘Price/earnings ratio = ‘ || pe_ratio);
END;
Procedure created.
No compilation errors. Only when you call it you got exception for zero divisor.
Correct Ans: B
declare
a number;
b number :=0;
c number;
begin
a := 500;
c := a/b;
end;
/
Error report –
ORA-01476: divisor is equal to zero
ORA-06512: at line 7
01476. 00000 – “divisor is equal to zero”
B) divisor is equal to zero
B
b
Good article. I certainly like your site. Keep it up!
http://wwwcenturionwealth.com/
Good article piece. I surely love this website. Stick with it!
http://www.investopedia.com/advisor-network/advisors/61757/wendy-ann-payne-csa-cep-/