设置customer_id
update t_user_identification u
set u.customer_id = (select c.customer_id
from t_customer c
where exists (select 1
from t_user us
where us.customer_id = c.customer_id
and exists
(select 1
from t_user_login_way y
where y.user_id = us.user_id
and y.user_name = u.open_id
and y.user_type = ''))
and rownum <= 1)
where u.identify_status in ('');
上面的方法有个缺陷,当数据过多时,数据库会因为执行时间太长而报错ORA-01555,导致全盘扫描中断,
改成下面这样问题就都解决啦
declare
v_num number;
begin
v_num := 0;
for f in (select id,open_id from t_user_identification where identify_status = '') loop
update t_user_identification u
set u.customer_id = (select c.customer_id
from t_customer c
where exists (select 1
from t_user us
where us.customer_id = c.customer_id
and exists
(select 1
from t_user_login_way y
where y.user_id = us.user_id
and y.user_name = f.open_id
and y.user_type = ''))
and rownum <= 1)
where u.identify_status in ('') and u.id = f.id;
v_num := v_num + 1;
if v_num > 50 then
begin
commit;
v_num := 0;
end;
end if;
end loop;
commit;
end;
设置customer_id的更多相关文章
- Linux命令总结大全,包含所有linux命令
使用说明:此文档包含所有的Linux命令,只有你想不到的没有你看不到的,此文档共计10万余字,有8400多行,预计阅读时间差不多需要3个小时左右,所以要给大家说一说如何阅读此文档 为了方便大家阅读,我 ...
- Mysql 外键设置
MySql外键设置详解 (1) 外键的使用: 外键的作用,主要有两个: 一个是让数据库自己通过外键来保证数据的完整性和一致性 一个就是能够增加ER图的可读性 有些人认为外键的建立会给 ...
- 如何在MySQL中设置外键约束
引用:http://blog.sina.com.cn/s/blog_53729e4601011wja.html MySql外键设置详解 (1) 外键的使用: 外键的作用,主要有两个: 一个是 ...
- SQL进阶-索引设置&sql优化
一.索引设置 1.索引的设置原则 经常出现在WHERE条件.关联条件中的字段作为索引字段: 在满足查询需求的前提下,应尽可能少的创建索引:(对于一个组合索引,可以满足以组合索引左边的一部分字段的查询需 ...
- 【mysql】一对一关系的理解,以及Navicat Premium怎么设置字段的唯一性(UNIQUE)?
背景:一对一关系设计方法: 设计2张表:customer表,student表 学生表中通过字段customer_id与customer表产生关系. student表中的customer_id与cust ...
- 【.net 深呼吸】设置序列化中的最大数据量
欢迎收看本期的<老周吹牛>节目,由于剧组严重缺钱,故本节目无视频无声音.好,先看下面一个类声明. [DataContract] public class DemoObject { [Dat ...
- LINUX篇,设置MYSQL远程访问实用版
每次设置root和远程访问都容易出现问题, 总结了个通用方法, 关键在于实用 step1: # mysql -u root mysql mysql> Grant all privileges o ...
- Visual Studio Code 代理设置
Visual Studio Code (简称 VS Code)是由微软研发的一款免费.开源的跨平台文本(代码)编辑器,在十多年的编程经历中,我使用过非常多的的代码编辑器(包括 IDE),例如 Fron ...
- myeclipse学习总结一(在MyEclipse中设置生成jsp页面时默认编码为utf-8编码)
1.每次我们在MyEclispe中创建Jsp页面,生成的Jsp页面的默认编码是"ISO-8859-1".在这种情况下,当我们在页面中编写的内容存在中文的时候,就无法进行保存.如下图 ...
随机推荐
- js iterable类型
遍历Array可以采用下标循环,遍历Map和Set就无法使用下标.为了统一集合类型,ES6标准引入了新的iterable类型,Array.Map和Set都属于iterable类型. 具有iterabl ...
- java 字符串截取类 区分中文、英文、数字、标点符号
package com.founder.fix.ims; /** * @author WANGYUTAO * 操作字符串 */ public class SubString { // public s ...
- this 关键字 详解
JS中的this关键字让很多新老JS开发人员都感到困惑.这篇文章将对this关键字进行完整地阐述.读完本文以后,您的困惑将全部消除.您将学会如何在各种不同的情形正确运用this. 我们和在英语.法语这 ...
- nodejs 后台开发 和C++代码开发
https://www.npmjs.com/package/node-gyp node-gyp Node.js native addon build tool Node.js native addon ...
- APM浅析
APM(Application Performance Management & Monitoring)一种基于云的性能监控服务(SaaS),以非侵入式监听探针,收集应用关键指标,生成分析报表 ...
- Spring ApplicationContext(五)invokeBeanFactoryPostProcessors
Spring ApplicationContext(六)BeanPostProcessor 产生回顾一下 ApplicationContext 初始化的几个步骤:第一步是刷新环境变量:第二步是刷新 b ...
- SCM_SVN_CVS
SCM_SVN_CVS SCM:一种用于记录并控制软件数据的工具.比如有:CVS(有过时趋势)和SVN(更加常用). 版本控制的概念: Respository:仓库 Workspace:工作台 Del ...
- python 字典遍历
dic1={"name":"kxb","age":28}for k,v in dic1.items(): print(k+",,, ...
- 使用scrollTop返回顶部
scrollTop属性表示被隐藏在内容区域上方的像素数.元素未滚动时,scrollTop的值为0,如果元素被垂直滚动了,scrollTop的值大于0,且表示元素上方不可见内容的像素宽度 由于scrol ...
- android DatagramSocket send 发送数据出错
安卓4.0以后好像不能在主线程里面使用 socket 所以不管是发送数据还是接收数据需要新开一个了线程: 以下代码是我点击发送是代码: new Thread(new Runnable() { @Ove ...