日期:2014-05-16 浏览次数:20729 次
create or replace procedure your_pro(in_date in date,
RetMemo out varchar2 --若失败,返回失败信息
)
is
v_cust_type varchar2(20);
v_count number;
cursor c_find is
select cust_id,100*round(e_money/sum(e_money)over(),4) bfb from
(select cust_id,sum(money) e_money from cust_dep_info where mounth=in_date group by cust_id );
cc c_find%rowtype;
begin
RetMemo :='';
v_count :=0;
open c_find;
loop
fetch c_find into cc;
exit when c_find%notfound;
if cc.bfb>=0 and cc.bfb<=20 then
v_cust_type :='核心客户';
elsif cc.bfb>20 and cc.bfb<=80 then
v_cust_type :='战略客户';
elsif cc.bfb>80 and cc.bfb<=100 then
v_cust_type :='普通客户';
end if;
update cust_info set