In the first table, pick records one by one and check whether basic-pay is less than 30000 or not, If basic-pay is less than 30000 then the gross-pay with be l75% of basic-pay else (more than 30000) gross-pay need to be calculated as l60%,
declare
low-pay constant number(3,2) = l,75; high-pay constant number(3,2) = l,60; l-gross-pay number(l6,2);
cursor cl is select * from emp-pay;
cl-val cl%ROWTYPE;
begin
open cl;
loop
fetch cl into cl-val;
exit when cl%NOTFOUND;
if cl-val,basic-pay <= 30000 then
l-gross-pay := cl-val,basic-pay * low-pay;
else
l-gross-pay := cl-val,basic-pay * high-pay;
end if;
insert into emp-gross values (cl-val,emp-id, l-gross-pay)
l-gross-pay := 0 ;
end loop;
close cl;
end;