RDBMS SOLUTION


ASSIGNMENT 4 

SET B Q. 3 SOLUTION

Write function which will take supplier number as input and print the total number of items supplied by him.




Source code:

    

    /*set b q 3 solution*/

/*function*/

create or replace function get_item(p_name in varchar2,sno out number )

return number is p_totno number;

begin

select supplierno into sno from supplier where supplier_name=p_name;

select count(item_number) into p_totno from i_s si where supplier_number=sno;

return p_totno;

end;

/*execution*/

declare

s_name varchar2(40):=:sname;

ino number;

total number;

begin

total:=get_item(s_name,ino);

dbms_output.put_line('total number of items supplied by' ||s_name||'=' ||total);

end;

/*source code in description*/

   

    
 Download code         next