oracle Update语句()
admin
2023-07-12 15:04:13
hu0829说的对,oracle和sql server不同,是没有update from这种语法结构的。
在使用left jion时,on和where条件的区别如下:
1、 on条件是在生成临时表时使用的条件,它不管on中的条件是否为真,都会返回左边表中的记录。
2、where条件是在临时表生成好后,再对临时表进行过滤的条件。这时已经没有left join的含义(必须返回左边表的记录)了,条件不为真的就全部过滤掉。
update a
set a.zch = (select b.zch
from b
where b.id = a.id
and rownum = 1)
where not exists (select 1
from b
where b.id = a.id
and b.zch = a.zch)
and length(a.zch) = 13
在两个表的id,zch上建一个联合索引。
update 表2
set B=C
from 表1,表2
你右键打开表就ok,就能直接操作
update 表 ,全部检索数据字典
更新数据存储过程
CREATE OR REPLACE PROCEDURE update_emp_proc(myempno IN NUMBER,myename IN VARCHAR2) AS
BEGIN
UPDATE emp SET ename=myename WHERE empno=myempno;
END;
找出主键,用游标可以完成!但特殊处理是哈,说清楚我写个例子出来
update t2 set c=(select b from t1 where t1.a = t2.a)
where exists(select 1 from t1 where t1.a = t2.a)
相关内容