Oracle Create触发器语句失败,内部错误代码为ORA-00600

时间:2012-11-21 20:29:54

标签: sql oracle triggers

尝试执行从Oracle创建的转储文件。在此块之前,所有内容都会被创建和修改:

CREATE OR REPLACE TRIGGER "LABS"."CHANNEL_CHANNEL_ID_TRG" BEFORE INSERT ON channel
FOR EACH ROW
DECLARE 
v_newVal NUMBER(12) := 0;
v_incval NUMBER(12) := 0;
BEGIN
IF INSERTING AND :new.CHANNEL_ID IS NULL THEN
SELECT  channel_CHANNEL_ID_SEQ.NEXTVAL INTO v_newVal FROM DUAL;
-- If this is the first time this table have been inserted into (sequence == 1)
IF v_newVal = 1 THEN 
  --get the max indentity value from the table
  SELECT NVL(max(CHANNEL_ID),0) INTO v_newVal FROM channel;
  v_newVal := v_newVal + 1;
  --set the sequence to that value
  LOOP
       EXIT WHEN v_incval>=v_newVal;
       SELECT channel_CHANNEL_ID_SEQ.nextval INTO v_incval FROM dual;
  END LOOP;
END IF;
--used to emulate LAST_INSERT_ID()
--mysql_utilities.identity := v_newVal; 
-- assign the value from the sequence to emulate the identity column
:new.CHANNEL_ID := v_newVal;
END IF;
END;

这会失败并切断连接,给出以下相当神秘的错误:

ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [kqlidchg1], [], [], [], [], [], [], [], [], [], [], []
ORA-00604: error occurred at recursive SQL level 1
ORA-00001: unique constraint (SYS.I_PLSCOPE_SIG_IDENTIFIER$) violated
00603. 00000 -  "ORACLE server session terminated by fatal error"
*Cause:    An ORACLE server session is in an unrecoverable state.
*Action:   Login to ORACLE again so a new server session will be create

1 个答案:

答案 0 :(得分:8)

找到一个有效的解决方案。使用以下ALTER语句包围代码块:

ALTER SESSION SET PLSCOPE_SETTINGS = 'IDENTIFIERS:NONE';

...这里的sql语句......

ALTER SESSION SET PLSCOPE_SETTINGS = 'IDENTIFIERS:ALL'; 

由于某种原因,Oracle数据库转储不包含这些命令,但这解决了这个问题。