Sql Server有的SQL语句写法不符合oracle写法下面这句注意要确保有一一对应关系,否则会出错 update T_A set Col1 = (select Colb from vw_B,T_A where T_A.Col1 = vw_B.colc ) where id=XX
oracle毕竟不同于sqlserver,你的语句应做如下的改造 update TableA a set status =(select nextflowpath from ViewB b where a.status=b.flowpath ) where exists (select 'X' from Viewb where b.flowpath=a.status);
oracle的sql和标准sql有比较大的不同。它对标准sql做了很多扩展。
hrb_qiuyb(大森林) 你的方法和 Cathy1其实差不多!
To : xunx 我的方法是可用的,实际中测试过的,Cathy1的方法可能会报错并不能达到你的全部更新的要求 实践是检验真理的唯一标准,测一下不就知道了吗!
to : hrb_qiuyb 请问在Oracle8中有没有直接关联的写法,谢谢!
update TableA set TableA.status = (select ViewB.nextflowpath from ViewB where TableA.status=ViewB.flowpath)TableA.status=ViewB.flowpath要唯一
beckhambobo(beckham) :请问! update TableA set TableA.status = (select ViewB.nextflowpath from ViewB where TableA.status=ViewB.flowpath) 如果不唯一,怎么班 TableA.status=ViewB.flowpath
update T_A
set Col1 = (select Colb from vw_B,T_A where T_A.Col1 = vw_B.colc )
where id=XX
update TableA a
set status =(select nextflowpath from ViewB b where a.status=b.flowpath )
where exists
(select 'X' from Viewb
where b.flowpath=a.status);
我的方法是可用的,实际中测试过的,Cathy1的方法可能会报错并不能达到你的全部更新的要求
实践是检验真理的唯一标准,测一下不就知道了吗!
set TableA.status = (select ViewB.nextflowpath from ViewB where TableA.status=ViewB.flowpath)TableA.status=ViewB.flowpath要唯一
update TableA
set TableA.status = (select ViewB.nextflowpath from ViewB where TableA.status=ViewB.flowpath)
如果不唯一,怎么班
TableA.status=ViewB.flowpath