求教一个oracle编程题.... - Oracle / 高级技术
有个表A表,B表,然后两个表都只有key 和value两个字段.
然后判断A表和B表的的key如果相同的话,把A表的value修改成为B的value
再问下cash when...then...else..end中可以嵌套几个else??
update a
set value = (select value from b
where b.key = a.key)
where exists (select 1 from b
where b.key = a.key)
update a set a.value=(select value from b where a.key=key)
晕!!!
为什么现在总是把有些sql想复杂了呢??
相关问答:
假设table01 中有 以下资料
emp_no emp_name
------- ------------
0001 TOM
0002 JOHN
0003 MARY
常用电话
而我们要得到以下的OUTPUT (或是各种其他的output)
0001,TOM
0002,JOHN
......
SQL code:
CREATE OR REPLACE PROCEDURE usp_refreshTopN IS
BEGIN
--文档
INSERT INTO topnresource(resourceId,title,type,cover,brief,properUser,tag,clickAmount,createDate,topNCreateDate,organizat ......
CREATE OR REPLACE PROCEDURE usp_refreshTopN
IS
BEGIN
--文档
INSERT INTO topnresource(resourceId,title,type,cover,brief,properUser,tag,clickAmount,createDate,topNCreateDate,o ......
今天遇到一个很诡异的问题。我在一张表中新增了一个字段。然后用如下脚本更新这个字段的值:
SQL code:
update ibp_fund_information_tab set yield = 7.4520 where fund_code = '040003' and info_date = ......