oracle更新日期字段怎么用一个表的多个字段数据更新另一个表相应的字段中

> oracle 中用一个表的字段update另一个表的字段值如何做
oracle 中用一个表的字段update另一个表的字段值如何做
lisspu2020 & &
发布时间: & &
浏览:5 & &
回复:5 & &
悬赏:0.0希赛币
oracle 中用一个表的字段update另一个表的字段值怎么做update (select a.contact_name cc, &
b.owner_contact do &
& from contctsm1 a, device2m1 b &where substr(b.logical_name, 5, 4) = a.station_id &
and a.contact_name &&b.owner_contact &
) set do=cc需要更新多条记录 但是我这样写报错 “无法修改与非键值保存表对应列”
  SQL code  --喜欢这种写法,直接方便!
update device2m1 t
set t.owner_contact = (select contact_name
from contctsm1 s
where substr(t.logical_name, 5, 4) = s.station_id
and s.contact_name && t.owner_contact);listentoyou & &
15:16:58 & &
& & (0)(0)引用update device2m1 t
set t.owner_contact = (select contact_name
from contctsm1 s
where substr(t.logical_name, 5, 4) = s.station_id
and s.contact_name && t.owner_contact);
listen18 & &
15:16:58 & &
& & (1)(0)引用
需要注意的有几点一 如果select contact_name
from contctsm1 s
where substr(t.logical_name, 5, 4) = s.station_id
and s.contact_name && t.owner_contact返回值不唯一,按你自己需要添加其他条件.二 如果不是要更新owner_contact中所有数据,需要增加where条件对需更新数据进行限定.
listen_snow & &
15:16:58 & &
& & (0)(0)引用
如果你能确定对应关系,还想用上面的写法,可以加注释,强制执行。  SQL code  update (
/*+ BYPASS_UJVC */
a.contact_name cc,
b.owner_contact do
from contctsm1 a, device2m1 b
where substr(b.logical_name, 5, 4) = a.station_id
and a.contact_name &&b.owner_contact
) set do=cc
listenling & &
15:16:58 & &
& & (0)(0)引用可以试试这个:update
device2m1 b& set owner_contact =(SELECT contact_name
FROM contctsm1 a ,device2m1 b&
WHERE substr(b.logical_name, 5, 4) = a.station_id and a.contact_name &&b.owner_contact)
listentoyou & &
15:16:58 & &
& & (0)(0)引用
本问题标题:
本问题地址:
温馨提示:本问答中心的任何言论仅代表发言者个人的观点,与希赛网立场无关。请对您的言论负责,遵守中华人民共和国有关法律、法规。如果您的言论违反希赛网问答中心的规则,将会被删除。
暂无合适的专家
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&oracle 中如何将表a的字段批量更新成另一表的字段_百度知道
oracle 中如何将表a的字段批量更新成另一表的字段
述 :表A 字段 product_id 与表B中的product 相等:表A的数据量在900万以上,如何将A的product_id 更新成表B的另一字段prod_id
提问者采纳
product=aupdate a set a.product_id=(select b.prod_id from b where b.product_id)
试过,3小时还没改完,效率太慢,有没有快点的啊
如果两个表是一一对应的话,那这样应该是最快的方法了,你可以检查下b.product上是不是建有有效的索引,这个数据量执行时间要3个小时肯定不正常
B表中的数据位7万多条,即,一个b.product可以对应多个a.product
那就加个条件:update a set a.product_id=(select b.prod_id from b where b.product=a.product_id) where exists(select 1 from b where b.product=a.prodct_id);这样操作的数据只有7w多条
效率还是不高,也不知是不是我们这边主机的问题,不过还是谢谢你了,
提问者评价
原来是这样,感谢!
相关专业回答
如果test_table1和test_table2是关联的才能叫更新,采用renfengjun1986的方法即可,如果两个表是没有关联的那就应该叫插入数据,采用nietiezheng 的方法。
其他类似问题
为您推荐:
oracle的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁17:50 提问
oracle根据表中的某个字段,按照这个字段把它分范围查询
比如一张表:两个字段(id,money)。
我要的结果是(根据money):
100—200的数据
200—400的数据
400—1000的数据
如何实现?
按赞数排序
你页面的需求是不是提供了 money的范围查询,然后依次有三个按钮100-200、200-400、400-1000 如果是这样,那么就直接是:
select *from tablename where money between moneymin and moneymax
当点击第一个100-200按钮时,就传100和200到后台,依次类推。。。。
分别查询union on连接起来
79关注|132收录
332关注|231收录
335关注|844收录
其他相似问题二次元同好交流新大陆
扫码下载App
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
&uboss用户的表 & & user_t &&customer_t
product_t &&price_t&
sub_price_tsubpri&&导入到jintan_cmis&三个表 & &&bs_user_info& & & &bs_area_info & & & & & & & &bs_product_infobs_user_info &bs_area_info,bs_product_info&里边是有字段的,有结构的。select distinct tv_no, u.card_no,(case when u.card_no like '%8519%' then 2 else 1 end) as manu,(case when length(u.tv_no)=8 then 0 else 1 end) as ordergin,u.terminal_no, cust.cust_name, cust.area_no from &user_t u ,customer_t cust where &cust.customer_id=u.customer_id and length(u.terminal_no)=17 and u.status&&2;select area_no,area_name from area_t;select prod.prod_id,prod.prod_name,subpri.PRICE*100 as price from product_t prod,price_t pri,sub_price_t &subpri where prod.PROD_ID=pri.PROD_ID and pri.PRICE_ID=subpri.PRICE_ID &and pri.PRICE_ID in (select max(price_id) from price_t where prod_id=prod.prod_id);使用命令和讲解:先给访问权限,上一篇,已经讲解怎么赋予权限,然后找到对应关系,然后再去执行插入数据,例子2,有相应的图。oracle两表字段不一样 怎么将数据从一个表插入到另一个表啊 比如a表是 name pwd sinsert into b (name1,pwd1,s1) select name,pwd,1.insert into bs_area_info(areaid,areanm) select area_no,area_name from uboss.area_t&执行完成后提交一下 否则没有数据。2.&insert into bs_user_info(fuuid,ficid,fic_type,fisgroup,fstbid,fcustom_name,fareaid)select distinct tv_no, u.card_no,(case&when u.card_no like '%8519%' then 2 else 1 end) as manu,(case when length(u.tv_no)=8 then 0 else 1 end) as&ordergin,u.terminal_no, cust.cust_name, cust.area_no from uboss.user_t u ,uboss.customer_t cust where cust.customer_id=u.customer_id and length(u.terminal_no)=17 and u.status&&2;执行完成后提交一下 否则没有数据oracle中用update批量替换字段中某字符串update 表明 t set t.fic_type=replace(fic_type,'1','DVN')将表中fic_type中的'1'替换为 DVN
阅读(4603)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
在LOFTER的更多文章
loftPermalink:'',
id:'fks_',
blogTitle:'Oracle 把一个表中的数据插入到另外一个表中
(导入另外一个表有字段的)',
blogAbstract:'PLSQL客户端用uboss用户登录oracle,执行下面三条语句。执行的数据导入到jintan_cmis用户三张表里,两个用户三张表分别为&uboss用户的表 & & user_t &&customer_t\t
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:6,
publishTime:0,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:1,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'0',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}oracle怎么用一个表的多个字段数据更新另一个表相应的字段中_百度知道
oracle怎么用一个表的多个字段数据更新另一个表相应的字段中
提问者采纳
要实时变动用触发器 不实时变动用update
update a set a.address from b where a.id=b.id=b.name=(&gt.adress=(select b.address&lt.name or a.name from b where a.id=b.name from b where a.id=b.id) where a.adress=(select b.name&lt.id);b;b,a,a.id)
------补充------&gt.name=(select b.id).address from b where a
知道智能回答机器人
我是知道站内的人工智能,可高效智能地为您解答问题。很高兴为您服务。
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 oracle更新字段为null 的文章

 

随机推荐