当前位置:首页 > 技术问答集
firefox

100 分。。错误的过程?谁帮我看看?

 所属目录:Java   |   类型:技术问答   |   时间:2007-05-21
 问题:

一个错误的过程?谁帮我看下?我怎么也调不对??要死了??  
  create   or   replace   procedure   showfetetime   (tvids   int,nextfetetime   out   date)  
  as  
      times   date;  
      nowfetename   varchar(50);  
      nexttime   date;  
      nextfetename   varchar(50);  
      todayminfetetime   date;  
      todaymaxfetetime   date;  
      startcount   number;  
      endcount   number;    
  begin  
  select       min(starttime)   into   todayminfetetime   from   fete  
  where   tvid   =   tvids   and   substr(starttime,1,4)   =   substr(to_char(sysdate,yyyy-mm-dd   hh24:mi:ss),1,4)   and     substr(starttime,6,2)   =     substr(to_char(sysdate,yyyy-mm-dd   hh24:mi:ss),6,2)     and   substr(starttime,9,2)   =   substr(to_char(sysdate,yyyy-mm-dd   hh24:mi:ss),9,2);  
      dbms_output.put_line(todayminfetetime);  
  select   max(starttime)   into   todaymaxfetetime   from   fete  
  where   tvid   =   tvids   and     substr(starttime,1,4)   =   substr(to_char(sysdate,yyyy-mm-dd   hh24:mi:ss),1,4)   and     substr(starttime,6,2)   =     substr(to_char(sysdate,yyyy-mm-dd   hh24:mi:ss),6,2)     and   substr(starttime,9,2)   =   substr(to_char(sysdate,yyyy-mm-dd   hh24:mi:ss),9,2);  
      dbms_output.put_line(todaymaxfetetime);  
       
  select     count(*)   into   startcount   from   fete                                                   --                                                                        
  where   starttime=(select   max(starttime)     from   fete   where   tvid   =   tvids   and   starttime<sysdate   and     starttime   >=todayminfetetime   );  
      dbms_output.put_line(startcount);  
   
  select     count(*)   into   endcount   from   fete   where   starttime   =   (select   min(starttime)     from   fete   where   tvid   =   tvids   and   starttime>sysdate   and   starttime   <=   todaymaxfetetime);  
      dbms_output.put_line(endcount);  
   
  if     startcount   =   0   and   endcount   =   0   then  
  update   onlinefete    
  set   nowfetetime   =   null,   nowfete   =   null,  
    nexttime   =   null,   nextfete   =   null  
  where   tvid   =   tvids;  
          nextfetetime   :=   null;  
  end   if;  
  if   startcount   =   0     then--表示是今天的第一个节目  
   
  update   onlinefete    
  set   nowfetetime   =   0,   nowfete   =   0  
  where   tvid   =   tvids;  
   
  select   starttime   ,   contents   into   nexttime,   nextfetename   from   fete    
  where   tvid   =   tvids   and     starttime   =  
  (  
  select   min(starttime)     from   fete  
  where   starttime>sysdate   and   tvid   =   tvids  
  );  
  update   onlinefete    
          set   nexttime   =   nexttime,   nextfete   =   nextfetename  
  where   tvid   =   tvids;  
   
  select   min(starttime)   into   nextfetetime   from   fete   where   starttime>sysdate   and   tvid   =   tvids;  
  end     if;  
  if   endcount   =   0     then  
  select     starttime   ,   contents   into   times,nowfetename   from   fete    
  where   tvid   =   tvids   and   starttime   =  
    (select   max(starttime)     from   fete  
  where   starttime<sysdate   and   tvid   =   tvids   );  
   
  update   onlinefete      
  set   nowfetetime   =   times,   nowfete   =   nowfetename    
  where   tvid   =   tvids;  
   
  update   onlinefete  
  set   nexttime   =   0,   nextfete   =   0  
  where   tvid   =   tvids   ;  
   
  select   min(starttime)   into   from   nextfetetime   fete   where   starttime>sysdate   and   tvid   =   tvids;  
  end   if;  
  if   startcount   !=   0   and   endcount   !=   0    
   
  select     starttime   ,contents   into   times   ,   nowfetename   from   fete    
  where   tvid   =   tvids   and   starttime   =  
    (select   max(starttime)     from   fete  
  where   starttime<sysdate   and   tvid   =   tvids   );  
   
  select   starttime,contents   into   nexttime,   nextfetename   from   fete    
  where   tvid   =   tvids   and     starttime   =  
  (  
  select   min(starttime)     from   fete  
  where   starttime>sysdate   and   tvid   =   tvids  
  );  
   
   
  update   onlinefete    
  set   nowfetetime   =   times,   nowfete   =   nowfetename,  
    nexttime   =   nexttime,   nextfete   =   nextfetename  
  where   tvid   =   tvids;  
   
  select   min(starttime)   into   nextfetetime   from   fete   where   starttime>sysdate   and   tvid   =   tvids;  
  end   if;  
  end   ;  
  谢谢?

.

· 网友精彩回答:

© 2006-2008 All Rights Reserved