Skip to content

Latest commit

 

History

History
44 lines (40 loc) · 642 Bytes

Ex-14.md

File metadata and controls

44 lines (40 loc) · 642 Bytes

BUILT-IN EXCEPTION

Q1 Divide by zero

declare
    a number;
    b number;
    c number;
    begin
    a:=&a;
    b:=&b;
    if(b>0)then
    c:=a/b;
    dbms_output.put_line('C is'||c);
    else
    c:=a/b;
    end if;
    exception
    when zero_divide then
    dbms_output.put_line('Divide by zero error');
   end;
   /

Q2 AGE

declare
    age number;
    inage exception;
    begin
    age:=&age;
  if ((age>=0) and (age<200))then
    dbms_output.put_line('Your Age is:'||age);
   else
    raise inage;
   end if;
   exception
   when inage then
   dbms_output.put_line('Invalid age error');
   end;
  /