这句话没看懂: rq为当日日期的sale相应的值
解决方案 »
- 关于ORACLE SERVICE 无法启动:1067 进程意外终止相关问题的请教。
- 安装oracle10g时提示升级oracle9i的数据库
- 在oracle中,普通用户如何访问dual表
- 触发器调用网络客户端程序时出错,why?
- 数据库的回滚
- plsql中 可以 使用 with 嗎???????????????????????????????????????
- 请高手达人来帮我看一下,我这个触发器有什么问题,第一次写不懂啊.
- 触发器能否用在同一张表?。。。。
- 高分求解:win2000 SERVER不能装oracle 8.0?
- ORACLE中的SID是个什么概念呀
- 尝试加载 Oracle 客户端库时引发 BadImageFormatException。如果在安装 32 位 Oracle 客户端组件的情况下以 64 位模式运
- 在线等,请教大神
更改P表中的name,条件是id和category相等
MERGE INTO products p
USING newproducts np
ON (p.product_id = np.product_id)
WHEN MATCHED THEN
UPDATE
SET p.product_name = np.product_name
WHERE p.category = np.category;
using biao1 b1
on (b1.id_man=b2.id_man)
when matchd then
update set
b2.sale =b1.sale
如果条件再严格一点,再加上
where b1.id_man in (select id_man from biao2)
来更新biao2中的sale值。
楼上的回答都漏了一个要求。且biao.rq为当日日期
set b.sale=(select nb.sale from (select b1.id_man,b1.sale from biao1 b1 join biao2 b2 on b1.id_man=b2.id_man where to_char(b1.rq,'yyyy-mm-dd')=to_char((select sysdate from dual),'yyyy-mm-dd')) nb where b.id_man=nb.id_man);注意如果biao1没有biao2的id_man
cursor cur_aa is select * from biao1;
begin
for cur_a in cur_aa
update biao2 set ... where id_man=cur_a.id_man and trunc(b1.rq)=trunc(sysdate);
end loop;
end;--It is a demo .
--if undo and temp tablespace are enough ,sql is more efficient than plsql
using (select * from biao1 where trunc(rq)=trunc(sysdate)) b1
on (b1.id_man=b2.id_man)
when matchd then
update set b2.sale =b1.sale;