I have created a trigger for my mysql project previously and it was working well. However, I am trying to change this trigger to make suitable for pl-sql(oracle). This is my original code which works in the mysql:
DELIMITER $$
CREATE TRIGGER course_title_delete AFTER DELETE on Course
FOR EACH ROW
BEGIN
DECLARE rownumber INT;
SET rownumber = (SELECT COUNT(*) FROM Course
WHERE Course_code=old.Course_code);
IF rownumber = 0
THEN
DELETE FROM Course_title
WHERE Course_title.Course_code=old.Course_code;
END IF;
END$$
DELIMITER ;
And this one is the same code which I have tried to convert pl-sql format. However it is not working, when I upload as a script and try to run it in apex.
CREATE OR REPLACE TRIGGER course_title_delete
AFTER DELETE ON course
FOR EACH ROW
BEGIN
DECLARE rownumber INT;
SET rownumber = (SELECT COUNT(*) FROM course
WHERE course_code= :old.course_code);
IF rownumber = 0
THEN
DELETE FROM course_title
WHERE course_title.course_code:=:old.course_code;
END IF;
END;
/