Я получаю эти ошибки:
INSERT INTO "DANIEL"."STATION" (NUM_STATION, NOM_STATION, ALTITUDE, REGION)
VALUES ('6', 'Baalbak', '1250', 'Baalbek')
ORA-04091: table DANIEL.STATION is mutating, trigger/function may not see it
ORA-06512: at "DANIEL.TRUPDATE_HIST_STATION", line 5
ORA-04088: error during execution of trigger 'DANIEL.TRUPDATE_HIST_STATION'
ORA-06512: at line 1
One error saving changes to table "DANIEL"."STATION":
Row 6: ORA-04091: table DANIEL.STATION is mutating, trigger/function may not
see it
ORA-06512: at "DANIEL.TRUPDATE_HIST_STATION", line 5
ORA-04088: error during execution of trigger 'DANIEL.TRUPDATE_HIST_STATION'
ORA-06512: at line 1
после вставки строки в табличную станцию
А вот код триггера, который я только что написал:
create or replace TRIGGER trupdate_hist_station
AFTER INSERT ON STATION
FOR EACH ROW
DECLARE
V_num_station NUMBER;
BEGIN
BEGIN
SELECT s.NUM_STATION
INTO v_num_station
FROM STATION s
WHERE s.NUM_STATION = :NEW.NUM_STATION;
EXCEPTION
WHEN no_data_found THEN
v_num_station :=0;
END;
INSERT INTO HIST_STATION
("NUM_STATION","ANNEE","NB_RESERV","REVENU")
VALUES
(V_num_station,(SELECT to_char(SYSDATE,'YYYY')FROM DUAL),0,0);
END trupdate_hist_station;
мне просто нужно добавить новую строку в Hist_table после добавления строки в таблицу Station