楼主的就是Oracle的写法吧?SQL Server中这么写:update A 
set 
    parent_id=B.menuitem_id
from 
    sec_menuitem A,
    sec_menuitem B
where
    B.menucode = LEFT(A.menucode,LEN(A.menucode)-2)

解决方案 »

  1.   

    对不起,错了SQLServer:
    update A set parent_id= (select menuitem_id from sec_menuitem where menucode = left(A.menucode,len(A.menucode)-2))
    from sec_menuitem AOracle:
    update A set parent_id= (select menuitem_id from sec_menuitem where menucode = substr(A.menucode,length(A.menucode)-2))
    from sec_menuitem A  
    oracle运行出现错误???
      

  2.   

    update A set parent_id= (select menuitem_id from sec_menuitem where menucode = substr(A.menucode,length(A.menucode)-2))
      

  3.   

    update A set parent_id= (select menuitem_id from sec_menuitem where menucode = substr(A.menucode,length(A.menucode)-2))
    from sec_menuitem A  
    where exists(select menuitem_id from sec_menuitem where menucode = substr(A.menucode,length(A.menucode)-2))
      

  4.   

    update sec_menuitem
    set parent_id = 
    (select a.menuitem_id from sec_menuitem a where a.menucode = substr(menucode,length(menucode)-2))
      

  5.   

    各位:
    在oracle中substr()参数应该是三个,substr(string,start,length)
      

  6.   

    oracle中update还要from关键字吗?
    好像是
    update 
    set 
    where
      

  7.   


    update (select a.order_no as vv,b.node_level as bb from gas a , dept b 
    where a.super_dept_id = b.dept_no  and b.dept_no = 'aaa')
    set vv = bb