如题,求助:
Oracle在表的主键上另加函数索引后 插入记录时报ORA-04091

解决方案 »

  1.   


    --不会的,是不是你表上有触发器,导致你发生变异表啊?connected to:
    oracle database 10g release 10.1.0.2.0 - productionsql> create table func_tab( id varchar2(10), amt number );table created.sql> alter table func_tab add constraint pk_func_tab primary key (id);table altered.sql> create index upper_func_tab on func_tab(upper(id));index created.sql> insert into func_tab values('abc',100);1 row created.sql> explain plan for select amt from func_tab where upper(id)='abc';explained.sql> select * from table(dbms_xplan.display());plan_table_output
    --------------------------------------------------------------------------------                                                               
    plan hash value: 2600287052                                                                   
                                                                                                  
    ----------------------------------------------------------------------------------------------
    | id  | operation                   | name           | rows  | bytes | cost (%cpu)| time     |
    ----------------------------------------------------------------------------------------------
    |   0 | select statement            |                |     1 |    20 |     2   (0)| 00:00:01 |
    |   1 |  table access by index rowid| func_tab       |     1 |    20 |     2   (0)| 00:00:01 |
    |*  2 |   index range scan          | upper_func_tab |     1 |       |     1   (0)| 00:00:01 |
    ----------------------------------------------------------------------------------------------
                                                                                                  
    predicate information (identified by operation id):                                           
    ---------------------------------------------------                                           
                                                                                                  
       2 - access(upper("id")='abc')                                                              
                                                                                                  
    note                                                                                          
    -----                                                                                         
       - dynamic sampling used for this statement                                                 
      

  2.   

    感谢gelyon
    的测试和回复,确实 我也建了同样的测试表和用样的函数索引,并没有发现此问题。对于触发器,不知可以通过什么方式查到引用该表的触发器?
      

  3.   

    你用的是Toad吗?
    如果你用PL/SQL的话,直接在界面上展开该表下面的Triggers就知道了
      

  4.   


    select trigger_name from user_triggers where table_name='EMP';
      

  5.   


    --这个错是发生了变异表事件
    select trigger_name,table_name from user_triggers where table_name='表名'select text from user_source where name='上面查到的触发器名'--看看触发器怎么写的