RDBMS SOLUTION


ASSIGNMENT 2 

SET A Q.1 SOLUTION

Write a PL/SQL block which accepts lab detail from user. If capacity is more than 40 then raise an user defined exception “Invalid_Capacity_Range” otherwise insert the record in the table.




Source code:

    

    /* set b q 3 solution

    in this we just have to use simple if-then-else statement*/

    declare

    lno number:=:lab_no;

    lname varchar2(40):=:lab_name;

    cap number:=:capacityl;

    equi varchar2(40):=:equipment;

    invalid_capacity exception;

    begin

    if(cap>40) then

        raise invalid_capacity;

    else

        insert into lab values(lno,lname,cap,equi);

    end if;

    exception

    when invalid_capacity then

    dbms_output.put_line('invalid');

    end;

source code in description

    

   

    
  Download code          next