日期:2014-05-17  浏览次数:20790 次

兄弟们,看看这个存储过程都有些什么语法错误,谢谢.
v_count   number(10);
v_area   varchar(6);
v_channel   varchar(6);
v_total   number(10);
v_datecount   number(10);
CURSOR   cur0   IS     select   CommissaryId,count(*)   as   MemberCount   from   t_s_memberInfo  
where   TO_DATE(CreateDate, 'YYYY-MM-DD ')=TO_DATE(sysdate, 'YYYY-MM-DD ')
group   by   CommissaryId   order   by   MemberCount   desc
BEGIN      
              v_count=0;  
              FOR   s   IN   cur0   LOOP
                  BEGIN    
                  v_count=v_count+1;  
                  v_total=0;
                  select   area   into   v_area   from   t_o_paragraphDecompound  
                  where   t_o_paragraphDecompound.commissary=s.CommissaryId   ;    
                  select   channel   into   v_channel   from   t_o_paragraphDecompound  
                  where   t_o_paragraphDecompound.commissary=s.CommissaryId   ;                  
                  select   total   into   v_total   from   t_o_dateTop   order   by   ri   desc;
                  v_total=v_total+s.MemberCount;
                  insert   t_o_dateTop(ri,area,channel,commissary,amount,total,classTop)  
                  values(sysdate,v_area,v_channel,s.CommissaryId   ,   s.MemberCount,v_total,v_count)
                  END;
            END   LOOP;
  END;


------解决方案--------------------
加上
create or replace procedure test
as
编译没有语法错误
如果执行错误,那可能是表和字段写的有问题,检查下
------解决方案--------------------
可以阿!
select area, channel into v_area,v_channel
from t_o_paragraphDecompound
where t_o_paragraphDecompound.commissary=s.CommissaryId ;
------解决方案--------------------
v_count number(10);
v_area varchar(6);
v_channel varchar(6);
v_total number(10);
v_datecount number(10);
CURSOR cur0 IS select CommissaryId,count(*) MemberCount from t_s_memberInfo
where TO_DATE(CreateDate, 'YYYY-MM-DD ') = sysdate group by CommissaryId ;

BEGIN
v_count := 0;
FOR s IN cur0 LOOP
v_count := v_count+1;
v_total := 0;
select area, channel into v_area, v_channel from t_o_paragraphDecompound
where t_o_paragraphDecompound.commissary=s.CommissaryId ;
//t_o_dateTop表中下列查询返回记录数可能大于1么,若大于1,则下列语句出错
select total into v_total from t_o_dateTop order by ri desc;
v_total := v_total+s.MemberCount;
insert into t_o_dateTop(ri,area,channel,commissary,amount,total,classTop)
values(sysdate,v_area,v_chan