我使用oracle sql developer创建了一个调用一个过程的触发器。以下是触发器的代码:
CREATE OR REPLACE TRIGGER noteTrigger
BEFORE
INSERT OR
UPDATE OF valoare OR
DELETE
ON note
BEGIN
CASE
WHEN INSERTING THEN
DBMS_OUTPUT.PUT_LINE('Inserting');
updateBursa();
WHEN UPDATING('valoare') THEN
DBMS_OUTPUT.PUT_LINE('Updating valoare');
updateBursa();
WHEN DELETING THEN
DBMS_OUTPUT.PUT_LINE('Deleting');
updateBursa();
END CASE;
END;
/
现在,程序写在这里:
CREATE OR REPLACE PROCEDURE updateBursa IS
v_countBursieri NUMBER := 0;
BEGIN
UPDATE STUDENTI SET bursa = null;
FOR v_i IN (SELECT nr_matricol from studenti natural join note group by nr_matricol having avg(valoare) =
(select max(avg(valoare)) from studenti natural join note group by nr_matricol)) LOOP
v_countBursieri := v_countBursieri + 1;
END LOOP;
FOR v_i IN (SELECT nr_matricol from studenti natural join note group by nr_matricol having avg(valoare) =
(select max(avg(valoare)) from studenti natural join note group by nr_matricol)) LOOP
UPDATE STUDENTI SET bursa = 1000/v_countBursieri where nr_matricol = v_i.nr_matricol;
END LOOP;
END;
/
当我尝试修改音符表时:
INSERT INTO note VALUES ('111', '25', 5, TO_DATE('20/06/2015', 'dd/mm/yyyy'));
我收到错误:
Error report -
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [kqlidchg0], [], [], [], [], [], [], [], [], [], [], []
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 was in an unrecoverable state.
*Action: Log in to Oracle again so a new server session will be created
automatically. Examine the session trace file for more
information.
Error report -
SQL Error: No more data to read from socket
答案 0 :(得分:0)
这是Ora-600你应该深入探讨为什么会出现你的情况,也许你应该打开SR。
另外,在您引用表格的代码中"注意"您正在创建一个触发器,这可能导致变异表,所以考虑更改代码逻辑的选项。
根据我的理解,您需要语句级触发器,而不是行级触发器?
答案 1 :(得分:0)
ORACLE server session terminated by fatal error
试试这个,在相同的“话题”上有同样的问题让我们说:)并且如前所示设置的东西只是解决了我的问题。祝你好运!