ORA ORA-02014 ORA-02014 cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.Cause: An attempt was made to SELECT... FOR UPDATE from a view whose defining SELECT 
statement uses at least one of the following constructs in its outer block: outer join, 
GROUP BY clause, aggregate functions, SELECT DISTINCT, CONNECT BY clause, or set 
operation, UNION, INTERSECT, or MINUS. Action: Do not use SELECT... FOR UPDATE on this view.

解决方案 »

  1.   

    感觉分页的算法需要修改了,因为其中有minus
      

  2.   

    但是我尝试了不用minus的方法,比如采用下面的方法:
     select x.* from  (select rownum t,hinmoku_mst.* from hinmoku_mst)x where x.t>20 and x.t<40
    最后加上 for update 后仍然出和上面一样的错误,我估计是因为rownum这个伪列和表中的列组成的视图x oracle无法进行锁操作,感觉oracle只能对固定的表的行数据才能进行加锁,所以请各位指教
      

  3.   

    感觉不能用那个view了,在where上想想办法吧
      

  4.   

    錯誤的Action里面講述的也滿清楚的嘛,檢察你的view吧。
      

  5.   

    把hinmoku_mst这个表结构贴出来
      

  6.   

    好的
    表结构如下:
    CREATE TABLE HINMOKU_MST
    (
        ZHIBAN                         CHAR(50) NOT NULL,
        HINBAN                         CHAR(50) NOT NULL,
        START_DATE                     CHAR(16),
        END_DATE                       CHAR(16),
        LONG_NM                        VARCHAR2(60),
        LONG_NM_E                      VARCHAR2(60),
        LONG_NM_J                      VARCHAR2(60),
        SHORT_NM                       VARCHAR2(30),
        SHORT_NM_E                     VARCHAR2(30),
        SHORT_NM_J                     VARCHAR2(30),
        BUNRUI_CD                      CHAR(10),
        JAN_CD                         CHAR(14),
        ZAIKU_KBN                      CHAR(5),
        APS_SALES_KBN                  CHAR(5),
        PLAN_HOUSIKI                   CHAR(5),
        ORG_CD                         CHAR(10),
        LLC                            NUMBER(5,0),
        ADD_TAN_CD                     CHAR(10),
        ADD_DATE                       DATE,
        UPD_TAN_CD                     CHAR(10),
        UPD_DATE                       DATE,
        DEL_FLG                        CHAR(1),
        CONSTRAINT PK_HINMOKU PRIMARY KEY (ZHIBAN, HINBAN)
    )
      

  7.   

    Restrictions on the FOR UPDATE Clause
    You cannot specify this clause with the following other constructs: the DISTINCT operator, CURSOR expression, set operators, group_by_clause, or aggregate functions. 
    The tables locked by this clause must all be located on the same database, and on the same database as any LONG columns and sequences referenced in the same statement. 
      

  8.   

    分页就是对于数据库中的数据按照一定的数量出现,比如每页20,30条数据,用户可以一页一页翻着看。锁就是对于用户抽出的数据(select)进行一个lock,以防止他人对抽出的数据进行更新