我有下面的一个批处理更新的SQL Server的语句,请问转到Oracle的语法是怎样的? 
这句SQL的含义是,用b表与a表关联,满足条件的a表的记录的字段用B表更新。如果不能实现这个,岂不是样定义Cursor来循环?UPdate tOperAll set fEmplName = b.EMPNAME ,fPWD = b.PassWord
 from tOperAll a ,Employee b
   Where  a.EMPNO = b.fEmplNo 
    and a.fSysNo = '1'哪位大侠能否提供一些Oracle的SQL写法的例子,包括左连接,右连接,子查询等内容,谢谢。

解决方案 »

  1.   

    转换为oracle为:
    update (select a.*,b.* from tOperAll a ,Employee b
    where a.EMPNO = b.fEmplNo 
        and a.fSysNo = '1') set fEmplName =EMPNAME ,fPWD = PassWord
      

  2.   

    谢谢大哥,我马上Try,看结构很有道理,还有其他的写法吗?
      

  3.   

    或者
    update tOperAll a set fEmplName =(select EMPNAME  from Employee b
    where Where  a.EMPNO = b.fEmplNo 
        and a.fSysNo = '1'),fPWD =select PassWord from Employee b
    where Where  a.EMPNO = b.fEmplNo 
        and a.fSysNo = '1');
    这样比较罗索
      

  4.   

    UPdate  tOperAll a  set  (fEmplName,fPWD)  =  (
    select b.EMPNAME,b.PassWord  
     from Employee  b  
         Where a.EMPNO  =  b.fEmplNo    
           and a.fSysNo = '1')
    where exits(select b.EMPNAME,b.PassWord  
     from Employee  b  
         Where a.EMPNO  =  b.fEmplNo    
           and a.fSysNo = '1') 
     
      

  5.   

    UPdate tOperAll a set 
    fEmplName =  (select b.EMPNAME from Employee b Where  a.EMPNO = b.fEmplNo ),
    fPWD = (select c.PassWord from Employee c Where  a.EMPNO = c.fEmplNo )
    where a.fSysNo = '1'没调过,试试吧
      

  6.   

    UPdate tOperAll a set 
    (fEmplName,fPWD) =  (select b.EMPNAME,b.PassWord from Employee b Where  a.EMPNO = b.fEmplNo )
    where a.fSysNo = '1'
      

  7.   

    还有就是
    UPdate tOperAll a set 
    (fEmplName,fPWD) =  (select b.EMPNAME,b.PassWord from Employee b Where  a.EMPNO = b.fEmplNo )
    where a.fSysNo = '1'
      

  8.   

    还有吗?让我开开眼界,我只熟悉SQL SERVER的语法。谢谢了
      

  9.   

    csdn的高手很多,热心人也很多,谢谢.
      

  10.   

    update (select a.*,b.* from tOperAll a ,Employee b
    where a.EMPNO = b.fEmplNo 
        and a.fSysNo = '1') set fEmplName =EMPNAME ,fPWD = PassWord这种写法还是第一次看见,真是长见识了!
      

  11.   

    update  (select  a.*,b.*  from  tOperAll  a  ,Employee  b  
    where  a.EMPNO  =  b.fEmplNo    
           and  a.fSysNo  =  '1')  set  fEmplName  =EMPNAME  ,fPWD  =  PassWord  这种写法效率应该比较好,普通的写法是什么?
      

  12.   

    update  (select  a.*,b.*  from  tOperAll  a  ,Employee  b  
    where  a.EMPNO  =  b.fEmplNo    
           and  a.fSysNo  =  '1')  set  fEmplName  =EMPNAME  ,fPWD  =  PassWord  这种写法效率应该比较好,普通的写法是什么?
      

  13.   

    结贴的密码就是你登录csdn的密码。
      

  14.   

    update 信息主表 x
      set x.尚欠发应付原因 = ( select h.欠款原因 from 欠款原因0304 h where trim(x.合同号) = trim(h.合同号) )
        where trim(x.合同号) = '03-1207A';