gpt4 book ai didi

sql - Oracle 创建触发器语句失败并出现内部错误代码 ORA-00600

转载 作者:行者123 更新时间:2023-12-02 12:56:28 25 4
gpt4 key购买 nike

尝试执行从 Oracle 创建的转储文件。一切都被创建和改变,直到这个 block :

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

最佳答案

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

ALTER SESSION SET PLSCOPE_SETTINGS = 'IDENTIFIERS:NONE';

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

ALTER SESSION SET PLSCOPE_SETTINGS = 'IDENTIFIERS:ALL'; 

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

关于sql - Oracle 创建触发器语句失败并出现内部错误代码 ORA-00600,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13501609/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com