update corp_reg r
set r.corp_code=(
select t.tech_reg_code
from t_ent_info_global t
where r.corp_name=t.ent_cname
) where exists (
select 1
from t_ent_info_global t
where r.corp_name=t.ent_cname
);分析一下执行计划,最好在 t_ent_info_global.ent_cname 上创建索引
set r.corp_code=(
select t.tech_reg_code
from t_ent_info_global t
where r.corp_name=t.ent_cname
) where exists (
select 1
from t_ent_info_global t
where r.corp_name=t.ent_cname
);分析一下执行计划,最好在 t_ent_info_global.ent_cname 上创建索引
解决方案 »
- oracle与sql,新手求教
- 怎么查询外键关系?
- 请问一下在VS2005里调用存储过程,存储过程的有一个变量是游标,请问这个游标在VC里该传入什么参数呢?
- oracle连接问题
- 第一回写oracle的存储过程,不知道那里错了很多
- 我的机器是xp系统,256M内存,2.3赛扬,已经装了sqlserver2000,想再装一个oracle看看,会不会系统崩溃阿??
- 我已经快疯了:一个查询SQL语句在查询时只有一条记录,但放在函数中调试时总提示"ORA-01422: 实际返回的行数超出请求的行数"错误,详情内
- 哪位给讲讲dual,tab,tabs,cat的意义和内容
- 怎样用PRO*C从ORACLE数据库中按一定条件提出一些记录并写到一个格式化的文本里?
- 删除主键约束不成功
- 求SQL语句,高手帮忙啊
- 如何将一个oracle数据库表的数据插入到另一个oracle数据库的表中
set r.corp_code=(
select t.tech_reg_code
from t_ent_info_global t
where r.corp_name=t.ent_cname
) where exists (
select 1
from t_ent_info_global t
where r.corp_name=t.ent_cname
);r.corp_name=t.ent_cname中存的是中文,我想要把两个表这两个字段如等于‘我的日记’的记录都只有一条,现在要t_ent_info_global表中的tech_reg_code更新到另一张表的corp_code中
执行后提示“单行子查询返回多于一个行”。
set r.corp_code=(
select max(t.tech_reg_code)
from t_ent_info_global t
where r.corp_name=t.ent_cname
) where exists (
select 1
from t_ent_info_global t
where r.corp_name=t.ent_cname
);
=(select t.tech_reg_code from t_ent_info_global t,corp_reg r where r.corp_name=t.ent_cname)
where r1主键=r主键
=(select t.tech_reg_code from t_ent_info_global t,corp_reg r where r.corp_name=t.ent_cname)
where r1主键=r主键
这样一定可以