Search This Blog

Total Pageviews

Tuesday 4 October 2011

plsql exception zero_divide

declare

the_ratio number;

lower_limit constant number:=1.72;

cursor c is
select empno,nvl(comm,0) comm from emp;

begin

-- open c /* not required */

for x in c loop

begin

the_ratio:=(x.empno/x.comm);

if the_ratio>lower_limit then
dbms_output.put_line('the ratio>lower limit:'||to_char(the_ratio));
else
dbms_output.put_line('the ratioend if;
exception
when zero_divide then
dbms_output.put_line('error zero divide');

end;
end loop;
end;

No comments:

Oracle DBA

anuj blog Archive