DBMS PRG9 Lab
DBMS PRG9 Lab
AIM:
To implement inventory database using PL/SQL.
ALGORITHM:
QUERIES
Step-4: Write PL/SQL for Update 20% rate for all products
delimiter $$
create procedure update_Rate()
begin
declare done int default 0;
declare upid int;
declare uprate numeric(10,2);
declare upname varchar(30);
declare cur cursor for select *from inventory;
declare exit handler for not found set done=1;
open cur;
upinv:loop
if done=1 then
leave upinv;
end if;
fetch cur into upid,upname,uprate;
set uprate=uprate+((uprate*20)/100);
update inventory set rate=uprate where pid=upid;
end loop;
close cur;
end $$
delimiter ;
call update_Rate();
RESULT:
The Above Result has been obtained successfully.