sql%rowcount 为零??

来源:互联网 发布:iphone日历记事本软件 编辑:程序博客网 时间:2024/06/03 02:37

begin
 starttime:=sysdate;
 v_maxtime := to_date('9999-12-31 00:00:00','yyyy-mm-dd hh24:mi:ss');  
 select max(f_logintime) into v_maxtime from t_gather_userloginlog;
 
  if  v_maxtime != to_date('9999-12-31 00:00:00','yyyy-mm-dd hh24:mi:ss') then
  
    insert  into t_gather_userloginlog (f_userid,f_username,f_logintime,f_userip,f_loginflag,f_logintype) --来源主网登陆的。
      select  f_uid,f_username,f_logintime,f_ip,f_flag,f_type from t_webloginlog_bak@link_stdby w where w.f_logintime > v_maxtime;
    
    insert into t_gather_userloginlog (f_userid,f_username,f_logintime,f_userip) --来源其他地方登陆。
     select ui_id,ui_username,ui_lasttime,ui_lastip
     from b_expuserinfo@link_stdby inner join t_webloginlog_bak@link_stdby
     on ui_username = f_username and ui_lastip = f_ip and f_logintime=ui_lasttime and f_logintime > v_maxtime
     where   f_username is null and ui_lasttime > v_maxtime;
   
     
  end if;
 
  rownumber := sql%rowcount;
  insert into t_base_sp_runlog values('gather','p_Gather_Day_i_UserLoginLog02',sysdate,'成功','INSERT', rownumber,round((dbms_utility.get_time-l_start)/100,2),starttime);
  commit;  

 

 

跑了很多天日志记录该过程影响行数为0! 不可能没有用户登陆啊

 

经过一番查证后:

    insert  into t_gather_userloginlog (f_userid,f_username,f_logintime,f_userip,f_loginflag,f_logintype) --来源主网登陆的。
      select  f_uid,f_username,f_logintime,f_ip,f_flag,f_type from t_webloginlog_bak@link_stdby w where w.f_logintime > v_maxtime;
  rownumber := sql%rowcount;--这里有数据
    


    insert into t_gather_userloginlog (f_userid,f_username,f_logintime,f_userip) --来源其他地方登陆。
     select ui_id,ui_username,ui_lasttime,ui_lastip
     from b_expuserinfo@link_stdby inner join t_webloginlog_bak@link_stdby
     on ui_username = f_username and ui_lastip = f_ip and f_logintime=ui_lasttime and f_logintime > v_maxtime
     where   f_username is null and ui_lasttime > v_maxtime;
      rownumber := sql%rowcount; --在这里变量被清空了
      
  end if;