如何写这样的sql 在线等待 update t set f4=f3 where f3>100; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼主要求一一对应,而update t set f4=f3 where f3>100;这样的语句是错误的,因为如果f3>100的记录超过1条,那么F4到底赋与哪个F3的值呢?我也遇到这样的问题,最后拿存储过程搞的 update tab aset 字段4=(select 字段3 from tab b where a.rowid=b.rowid and a.字段3>100); 1 111 2 1 111 200 200 1 111 2 1 111 200 200 1 111 2 1 111 400 400 1 111 3 不好意思,把自己的答案更正一下下啦:SQL> create table t(f1 varchar2(2),f2 varchar2(4),f3 integer,f4 integer);表已创建。SQL> begin 2 insert into t values('01','0111',2,null); 3 insert into t values('01','0111',200,null); 4 insert into t values('01','0111',2,null); 5 insert into t values('01','0111',200,null); 6 insert into t values('01','0111',400,null); 7 insert into t values('01','0111',30,null); 8 commit; 9 end; 10 /PL/SQL 过程已成功完成。SQL> select * from t;F1 F2 F3 F4-- ---- ---------- ----------01 0111 201 0111 20001 0111 201 0111 20001 0111 40001 0111 30已选择6行。SQL> update t a 2 set f4=f3 3 where exists (select 1 from t b where b.rowid=a.rowid and b.f3>100);已更新3行。SQL> select * from t;F1 F2 F3 F4-- ---- ---------- ----------01 0111 201 0111 200 20001 0111 201 0111 200 20001 0111 400 40001 0111 30已选择6行。 修改触发器的触发时间 树节点的问题 有点急 oracle如何实现增量备份?? Oracle IO 异常 【求助】怎么插入“&”符号????? Oracle中有没有象SQL Sever 2000中附加数据库的功能 急!高分求教!数据库的物理模型改如何评价? 急!ORACLE角色问题!超简单!来者有分! 请高手给出outer join 和inner join的区别,讲的越详细越好,最好有用例,谢谢。 怎样更改 ORACLE 字符集? oracle的资源占用怎么这么大??? 什么数据类型不可以作为索引列呢?
set 字段4=(select 字段3 from tab b where a.rowid=b.rowid and
a.字段3>100); 1 111 2
1 111 200 200
1 111 2
1 111 200 200
1 111 2
1 111 400 400
1 111 3
2 insert into t values('01','0111',2,null);
3 insert into t values('01','0111',200,null);
4 insert into t values('01','0111',2,null);
5 insert into t values('01','0111',200,null);
6 insert into t values('01','0111',400,null);
7 insert into t values('01','0111',30,null);
8 commit;
9 end;
10 /PL/SQL 过程已成功完成。SQL> select * from t;F1 F2 F3 F4
-- ---- ---------- ----------
01 0111 2
01 0111 200
01 0111 2
01 0111 200
01 0111 400
01 0111 30已选择6行。SQL> update t a
2 set f4=f3
3 where exists (select 1 from t b where b.rowid=a.rowid and b.f3>100);已更新3行。SQL> select * from t;F1 F2 F3 F4
-- ---- ---------- ----------
01 0111 2
01 0111 200 200
01 0111 2
01 0111 200 200
01 0111 400 400
01 0111 30已选择6行。