刚才代码写错了,
我的代码
update xiujuan a,jiafu b set a.yxts = b.yxts 
where a.id = b.no and b.yxts is not null and a.yxt is null ;可是好像不能用,问一下高手,是我的代码有问题吗,还是 就没有这个功能,就不能同时在两张表里update xiujuan a,jiafu b set a.ysts= b.yxts where a.id=b.no and b.yxts is not null and a.yxts is nul
                *
ERROR 发生在第 1 行:
ORA-00971: 缺少 SET 关键字

解决方案 »

  1.   

    update xiujuan set YXTS=nvl((select jiafu.YXTS from jiafu where xiujuan.NO=jiafu.NO),YXTS);
      

  2.   

    update xiujuan  set xiujuan.yxts = jiafu.yxts 
    where xiujuan.id = jiafu.no and jiafu.yxts is not null and xiujuan.yxt is null ;
      

  3.   

    这句sql里面能通过oracle通不过哦
      

  4.   

    update xiujuan A set YXTS=(select YXTS from jiafu B where A.NO=B.no)
      

  5.   

    update xiujuan set yxts=nvl((select jiafu.ysts from jiafu where xiujuan.id=jiafu.no),yxts)
                                 *
    ERROR 发生在第 1 行:
    ORA-00936: 缺少表达式
    ++++++++++++++++++++++++++++++++++++++++++++  1  update xiujuan  set xiujuan.yxts = jiafu.yxts
      2* where xiujuan.id = jiafu.no and jiafu.yxts is not null and xiujuan.yxts is null
    where xiujuan.id = jiafu.no and jiafu.yxts is not null and xiujuan.yxts is null
                                          *
    ERROR 发生在第 2 行:
    ORA-00904: 非法的列名++++++++++++++++++++++++++++++++++++++++++++update xiujuan A set YXTS=(select YXTS from jiafu B where A.NO=B.no)更新3个记录.SQL> select  * from xiujuan;ID   YXTS FL
    ---- ---- --
    1    1    ye
    2    2
    3    3能通过,但是一次更新了,三条记录,运行的结果也算全对!!!原来是
    SQL> select * from xiujuan;ID   YXTS FL
    ---- ---- --
    1    5    ye
    2
    3
    前两个的我也不知道是怎么错的,
    修改第三句的   增加条件   a.yxts is null and b.yxts is not null
    运行的结果是:把 xiujuan 原来的第一条记录的 yxts 给搞成空的了!!! 不知道该怎么办了???SQL> update xiujuan A set YXTS=(select YXTS from jiafu B where A.id=b.no and a.yxts is null and b.yx
    ts is not null);更新3个记录.SQL> select * from xiujuan;ID   YXTS FL
    ---- ---- --
    1         ye
    2    2
    3    3