写了一个update语句更新Oracle数据库,不知道为什么,报错说“语法未结束”,语句如下 :
update z304 
set z304_telephone_4='13918273648',z304_EMAIL_ADDRESS='[email protected]
from z304,z308 
where trim(substr(z308_rec_key,1,22))='0260123' and 
trim(substr(z304_rec_key,1,12))=trim(z308_id) and 
trim(substr(z304_rec_key,13,14))='01'

解决方案 »

  1.   

    update z304 
    set z304.z304_telephone_4='13918273648',z304.z304_EMAIL_ADDRESS='[email protected]
    from z304,z308 
    where trim(substr(z308.z308_rec_key,1,22))='0260123' and 
    trim(substr(z304.z304_rec_key,1,12))=trim(z308.z308_id) and 
    trim(substr(z304_rec_key,13,2))='01'
      

  2.   

    jssg_tzw:您给的答案不行的,字段名都是唯一不重复的应该是不用带表名也可以的。你这个语句执行后,同样显示错误“SQL command not properly ended”
      

  3.   

    update z304 
    set z304_telephone_4='13918273648',z304_EMAIL_ADDRESS='[email protected]
    -- from z304,z308 Update没有这个, 将其写在Where子句中
    where trim(substr(z308_rec_key,1,22))='0260123' and 
    trim(substr(z304_rec_key,1,12))=trim(z308_id) and 
    trim(substr(z304_rec_key,13,14))='01'哥们,你写的这个Sql性能很差,如果有索引,该破坏的全都被你破坏掉了
      

  4.   

    shiqiang_03:哥们,那你说该怎么写呢?
      

  5.   

    还是自己看了一下,这样写就可以了。
    update z304
    set z304_telephone_4='13918273648',z304_EMAIL_ADDRESS='[email protected]
    where trim(substr(z304_rec_key,1,12))=
         (select trim(z308_id) from z308
          where trim(substr(z308_rec_key,1,22))='0260123') and
         trim(substr(z304_rec_key,13,14))='01'