tab a (col1,col2)
tab b (col1,col3)update a set a.col1=b.col3 from a,b where a.col1=b.col1这句在SQLserver可以执行,在oracle下不行。请教在oracle下面怎么改?100分相送!
tab b (col1,col3)update a set a.col1=b.col3 from a,b where a.col1=b.col1这句在SQLserver可以执行,在oracle下不行。请教在oracle下面怎么改?100分相送!
解决方案 »
- oracle被一堆insert和update堵死
- 统计学习时间SQL语句问题?
- oracle 临时表阻塞
- 拜求一条sql--可糅合现有的两条sql
- 请问PHP连接OR后,如何让执行这个命令是正确的返回1||||oracle连接PHP中和mysql_num_rows函数相同的是那个,
- mysql 的数据库,有没有办法转到oracle中,大家谈谈思路吧
- 表all_tab_cols不存在
- 两张表合成一个视图,请高手帮忙最好能通过一个SQL语句实现
- 求助有关返回一个月中第几周的涵子
- ALTER SESSION SET SQL_TRACE TRUE'的若干问题
- 数据实时更新的设计!!五百分!!!!
- 能否新建一个Oracle的方案呢?高手指点
set
a.col1=(select col3 from a,b where a.col1=b.col1)
where a.col1=b.col1
set
a.col1=(select col3 from a,b where a.col1=b.col1)
where a.col1=b.col1 AND B.COL1 IS NOT NULL
我把你们的语句在sqlplus试了一下,系统提示
ORA-00904: invalid column namewhere a.col1=b.col1
*
set
a.col1=(select col3 from a,b where a.col1=b.col1)
where a.col1=(select a.col1 from a,b where a.col1=b.col1)
--------------------------------------- ---------------------------------------
1 100
2 200SQL> select * from b; COL1 COL3
--------------------------------------- ---------------------------------------
1 900
3 700SQL>
SQL> update a
2 set
3 a.col1=(select col3 from a,b where a.col1=b.col1)
4 where a.col1=(select a.col1 from a,b where a.col1=b.col1)
5 ;1 row updatedSQL> select * from a; COL1 COL2
--------------------------------------- ---------------------------------------
900 100
2 200SQL>
2 set
3 a.col1=(select col3 from a,b where a.col1=b.col1)
4 where a.col1=(select a.col1 from a,b where a.col1=b.col1)
5 ;
改成
update a
2 set
3 a.col1=(select col3 from a,b where a.col1=b.col1)
4 where exists (select col3 from a,b where a.col1=b.col1);
会快一些