To dinya2003(OK) :
想实现以tblcustomerTmp表中记录更新符合条件的tblcustomer 表中的concat_addr字段。
tblcustomer中总共有40000多条记录,tblcustomerTmp中有15000多条记录。
原来有个where条件:
WHERE exists(
SELECT c.concat_addr
FROM tblcustomerTmp c
WHERE a.vin=c.vin and a.qad_userid is not null
and a.category_flag='C' and a.status_flag=1
and substr(a.qad_userid,length(rtrim(a.qad_userid))-5,6)
=substr(a.vin,length(a.vin)-5,6)
)
加上where子句后执行超过1个多小时尚未执行完毕,郁闷!求高人解答!
想实现以tblcustomerTmp表中记录更新符合条件的tblcustomer 表中的concat_addr字段。
tblcustomer中总共有40000多条记录,tblcustomerTmp中有15000多条记录。
原来有个where条件:
WHERE exists(
SELECT c.concat_addr
FROM tblcustomerTmp c
WHERE a.vin=c.vin and a.qad_userid is not null
and a.category_flag='C' and a.status_flag=1
and substr(a.qad_userid,length(rtrim(a.qad_userid))-5,6)
=substr(a.vin,length(a.vin)-5,6)
)
加上where子句后执行超过1个多小时尚未执行完毕,郁闷!求高人解答!
解决方案 »
- 配置Linux的oracle RAC时,每个结点的eth0网卡通讯问题
- 关于sqlplus developer使用或者oracle下创建角色或者用户的问题
- 【SOS】 Oracle 单表去重复 千万级数据量
- tnsping 解析别名问题
- 请高手提供一个具体的oracle触发器例子
- ORACLE的猪头问题ORA-01722错误
- 帮忙找一篇关于安装oracle软件、创建数据库、创建实例、创建用户这几个概念的关联关系。
- 密码忘记了。。。。。。。。。。?
- 是否有方便点的浏览器,像delphi的SQL Explorer那样
- 我想用POWERDESINGER 9 对ORACLE8 做反向工程,导出其结构......
- describe table问题!!!!!!!!!!!!!!!!!!
- 紧急求救!
用pl/sql,先以某个条件从tblcustomerTmp选出若干条记录,这个条件要能够尽可能的把范围缩小,又可以用上index。然后在loop中,用你的业务逻辑check该条纪录,ok的话,如果该条记录在tblcustomer中存在的话,执行update(你的这两个表的主键应该是一样的吧)2个几万条记录的表,只要数据库的配置不是很离谱,几分钟内应给可以执行完毕的。
update (
SELECT a.concat_addr addr1, b.concat_addr addr2, a.title title1, b.title title2,
a.sex_code sex_code1, b.sex_code sex_code2, a.cust_mp cust_mp1, b.cust_mp cust_mp2,
a.province province1, b.province province2, a.city city1, b.city city2,
a.cust_postcode cust_postcode1, b.cust_postcode cust_postcode2
FROM tblcustomer a,tblcustomerTmp b
WHERE
a.cust_id=b.cust_id
and a.category_flag='C' and a.status_flag=1
and substr(a.qad_userid,length(trim(a.qad_userid))-5,6)
=substr(a.vin,length(a.vin)-5,6)
)
set addr1=addr2, title1=title2, sex_code1=sex_code2, cust_mp1= cust_mp2, province1=province2,
city1=city2, cust_postcode1=cust_postcode2