简体   繁体   中英

triggers SQL error sql syntax

Hello I am trying to little by little make triggers work. But The following code gives me the error Error(10,1): PLS-00103: Påträffade symbolen "INSERT"
In other words its referring to my insert into registrations and says that the symbol insert can't be found. I really don't understand why this is possible. Help is much appreciated

create or replace TRIGGER TR_Put_To_Waits   
INSTEAD OF INSERT ON Registrations
REFERENCING NEW AS newline
FOR EACH ROW
DECLARE 
HasntPassedCourse INT;
BEGIN
SELECT COUNT(*) INTO HasntPassedCourse
FROM PassedCourses P
WHERE P.code != :newline.code AND P.cid != :newline.cid;

dbms_output.Put_line(HasntPassedCourse);

END;

insert into REGISTRATIONS
(CID,CODE,STATUS)
values
('arne','tda401','registered');
rollback; 

You can't create an INSTEAD OF trigger on a table. Try BEFORE or AFTER.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM