I am new to Oracle and I am trying to create a trigger.
In my trigger I have the following line and Oracle tell me that this not correct. What is wrong with that section.
CREATE OR REPLACE TRIGGER CHECK_SEC_AI
AFTER INSERT ON PROFILE
FOR EACH ROW
BEGIN
IF (SELECT THING, PERSONROGROUP FROM SECURITY WHERE THING= :OLD.SYSTEM_ID AND PERSONORGROUP = 0) <>NULL
THEN
DELETE FROM SECURITY WHERE THING = :OLD.SYSTEM_ID
AND PERSONORGROUP = 0;
END IF;
END;
What I want to do is verify if the entry exist in my security table and delete it if it does as it should not be there. The system_id is the primary key that reference the entry in my profile table and personorgroup is an Id that reference the primary id from an other table. So if there is an entry in my security table having a thing 1111 and a group 0 I want to delete it.
In my trigger I have the following line and Oracle tell me that this not correct. What is wrong with that section.
CREATE OR REPLACE TRIGGER CHECK_SEC_AI
AFTER INSERT ON PROFILE
FOR EACH ROW
BEGIN
IF (SELECT THING, PERSONROGROUP FROM SECURITY WHERE THING= :OLD.SYSTEM_ID AND PERSONORGROUP = 0) <>NULL
THEN
DELETE FROM SECURITY WHERE THING = :OLD.SYSTEM_ID
AND PERSONORGROUP = 0;
END IF;
END;
What I want to do is verify if the entry exist in my security table and delete it if it does as it should not be there. The system_id is the primary key that reference the entry in my profile table and personorgroup is an Id that reference the primary id from an other table. So if there is an entry in my security table having a thing 1111 and a group 0 I want to delete it.