最初由 myfriend2010 发布
[B]update (selectb.passwd,b.olduserid,a.olduserid tt from b,a where a.newuserid = b.newuserid) x
set x.passwd =(select c.passwd from c
where
x.tt= c.olduserid)
好像在那儿看到过可以这么写!不知道可以不,帮忙求证一下!
--------------------------- [/B]
sql>create table a(olduserid number(3),newuserid number(3));
表已创建。
sql>create table b(newuserid number(3),passwd varchar2(10));
表已创建。
sql>create table c( olduserid number(3),passwd varchar2(10));
表已创建。
sql>update (select b.passwd,b.olduserid,a.olduserid tt from b,a where a.newuseri
d = b.newuserid) x
2set x.passwd =(select c.passwd from c where x.tt= c.olduserid);
update (select b.passwd,b.olduserid,a.olduserid tt from b,a where a.newuserid =
b.newuserid) x
*
ERROR 位于第 1 行:
ORA-00904: "B"."OLDUSERID": invalid identifier
sql>update (select b.passwd,b.newuserid,a.olduserid tt from b,a where a.newuseri
d = b.newuserid) x
2set x.passwd =(select c.passwd from c where x.tt= c.olduserid);
set x.passwd =(select c.passwd from c where x.tt= c.olduserid)
*
ERROR 位于第 2 行:
ORA-01779: cannot modify a column which maps to a non key-preserved table
sql>
所以结果是不行。
|