表tableall大约有4千万条记录,表的格式如下:
QUERYTIME     DATE  
USERID     VARCHAR2(30)  
QUERYWORDS     VARCHAR2(150)  
URLRANK     NUMBER  
USERCLICKNUM     NUMBER  
PAGEURL     VARCHAR2(200)  
现在想要的结果是:pageurl前100字符相同且userid不同的连接结果。方法如下:
insert into tableurl nologging(
select f,g,h,i,c,d from(
select a.userid f,b.userid g,a.querywords h,b.querywords i,
substr(a.pageurl,1,100) c,
substr(b.pageurl,1,100) d
from tableall a,tableall b )where c=d and f!=g );
运行了大约1个半小时,出现ORA-30036: unable to extend segment by 8 in undo tablespace 'UNDOTBS1''的错误。
按照http://blog.oracle.com.cn/html/74/t-134574.html的建议,也做了修改,不过还是出现同样的错误。
后又改为采用游标操作,方法如下:
declare
cursor cursor_select is select f,g,h,i,c,d from(select a.userid f,b.userid g,a.querywords h,b.querywords i,substr(a.pageurl,1,100) c,substr(b.pageurl,1,100) d from tableall a,tableall b )where c=d and f!=g ;
v_id number;
t1 tableall.userid%type;
t2 tableall.userid%type;
t3 tableall.querywords%type;
t4 tableall.querywords%type;
t5 varchar2(100);
t6 varchar2(100);
begin
 open cursor_select;
loop
 fetch cursor_select into t1,t2,t3,t4,t5,t6;
    exit when cursor_select%notfound;
   insert into tableurl nologging values(t1,t2,t3,t4,t5,t6);
   v_id:=v_id+1;
  if v_id=10000 then
   commit;
   v_id:=0;
 end if;
 end loop;
 commit;
end;
运行了大约2小时,还是同样的错误,请各位给点建议,十分感谢。oracle为10g,安装采用默认方式。