17,086
社区成员
发帖
与我相关
我的任务
分享
create or replace procedure pp(in_num number,out_num out number) as
total1 number:=0;
total2 number:=0;
begin
select sum(s.totalmoney) into total1 from salerecord s where s.customerid = in_num;
select sum(s.totalmoney) into total2 from salerecord s;
out_num := round((total1/total2*100),2);
dbms_output.put_line('地区编号为'||in_num||'的地区的销售额占总销售的百分之:'||out_num);
end;
declare
t_t number;
begin
-- Call the procedure
pp(2,t_t);
dbms_output.put_line(t_t);
end;