解决方案 »
- rownum 和 order by 的问题?
- oracle group 计算sql
- 怎么样在ORACEL函数中建临时表?急
- ECLIPSE的图片显示问题
- 字符型转换(99:99)
- Oracle 10g R2安装问题,在线等。。。
- jsp与oracle中日期型数据转换问题
- 这么短的一个sql语句,我则么这么多不会的地方呢??
- 在orcale中建表时字段的说明在那写???
- help!!!!!!!!!problem encounterred when starting snmp for oracle 9iiiii
- 着急,跪求高手帮忙看看,谢谢!
- 如何将一台服务器Oracle下的数据定时同步到另一台服务器的Mysql数据库(求教...)
如:update ta set a=(select nvl(tb.a,ta.a) from tb);
如:update ta set a=(select nvl(tb.a,ta.a) from tb);这个是不是只能用在 updata table_a set a =……, b =……,c=……,这种方式上,因为 更新有关联条件限制,所以想以这种 set (a, b, c ,d, e ,f ,g)
= ( select a, b, c ,d, e ,f ,g from table_b ) 多个字段一起更新的方式, 这种方式的话,改怎么办?
MERGE INTO ta p
USING tb np
ON (p.c1 = np.c1 and p.c2 = np.c2) --连接条件
WHEN MATCHED THEN
UPDATE
SET p.c3 = nvl(np.c3, p.c3), p.c4 = nvl(np.c4, p.c4) --注意此处update的字段不能作为连接字段(不能更新c1,c2字段)
WHERE p.c4 = 'sasfdsa' --可以叫条件过滤
update table_a
set (a, b, c ,d, e ,f ,g)
= ( select a, b, c ,d, e ,f ,g from table_b where id=table_a.id)
where exists (select 1 from table_b where id=table_a.id)
set (a, b, c ,d, e ,f ,g)
= ( select NVL(A.a,B.a),NVL(A.b,B.b),…… from table_b B where id=A.id )
where exists (select 1 from table_b B where id=A.id)