declare done_1 int;

   declare continue handler FOR SQLSTATE '02000' SET done = 1; 
 
   open cur_recordset; 
   
   repeat 
      FETCH cur_recordset INTO v_id , v_opc, v_dpc, v_sccp_type, v_slr, v_dlr ; // 外循环遍历记录,最终会出现SQLSTATE '02000',即所有记录全部遍历完成,done的值会变为1。
      
  set done_1=done;
  
      if v_sccp_type=6 then
            
              select session_id_online into v_session_id_find  // 内查询结查,有可能出现"NO DATA",SQLSTATE= "02000"
      from online_session
      where slr= v_dlr and opc=v_dpc and dpc=v_opc ;
       
      if v_session_id_find IS NOT NULL then
           update  source_db set session_id= v_session_id_find where id=v_id;  
      end if;      end if; 
      
set done=done_1;
  
      until done  
   end repeat; 
   
  CLOSE cur_recordset;
end;//