执行下面的sql, 老是报错。 但单独执行select一点问题都没有。ORA-04052: 在查找远程对象时出错
ORA-01948: 标识符的名称长度(37) 超过最大长度(30)注, tt_address_web 是个public synonymeDECLARE
cursor sel_cur is 
  select "uid" 
  from tt_address_web
  where 1=1 
  and "deleted" = '0' 
  and "pid" = '503'; BEGIN
FOR sel_rec in sel_cur 
LOOP
  update tt_address_web set "deleted" = '1' where "uid" = sel_rec.U_ID;  
 commit;  
END LOOP;
END;
/

解决方案 »

  1.   

    DECLARE
    cursor sel_cur is 
      select uid
      from tt_address_web
      where 1=1 
      and deleted = '0' 
      and pid = '503'; BEGIN
    FOR sel_rec in sel_cur 
    LOOP
      update tt_address_web set deleted = '1' where uid = sel_rec.U_ID;  
     commit;  
    END LOOP;
    END;
      

  2.   

    楼上的兄弟啊, 去掉双引号还是不行啊, 去掉后连select都不行了。 还有没有其他办法啊。
      

  3.   

    DECLARE
    cursor sel_cur is 
      select uid
      from tt_address_web
      where 1=1 
      and deleted = '0' 
      and pid = '503'; BEGIN
    FOR sel_rec in sel_cur 
    LOOP
      execute immediate 'update tt_address_web set deleted=''1'' where    uid='||sel_rec.U_ID;  
     commit;  
    END LOOP;
    END;
     
     
    这样试一下,貌似块里面要使用动态的sql。
      

  4.   

    Error:  ORA 4052
    Text:   error occurred when looking up remote object %s%s%s%s%s
    -------------------------------------------------------------------------------
    Cause:  An error has occurred when trying to look up a remote object.
    Action: Fix the error.  Make sure the remote database system has run
            KGLR.SQL to create necessary views used for querying/looking up
            objects stored in the database.*** Important: The notes below are for experienced users - See Note:22080.1
    Note:
            KGLR.SQL is now called catrpc.sql - it is run from catproc 
    运行这个catrpc.sql 脚本试试。在$ORACLE_HOME/rdbms/admin下
      

  5.   

    楼上的兄弟, remote端的是mysql的数据库
      

  6.   

    这个应该是在筛选条件中超过列uid的长度,把where uid = sel_rec.U_ID写死,如:
    where uid=1 如果不报错自然就是这里的问题。
      

  7.   

    对的, 如果我写 where uid=1 那就可以运行, 但应该怎么写呢?