Good everyone!
I am new to the Oracle world and I need to create a trigger but I am having a problem with it. The trigger I need as to verify a value in my table 1 and if that value is null or set to 0 than I need to change the value to 1 and verify if my table 1 already have information it it, referencing the ID of the first table.
Here is what I am trying to place in.
CREATE OR REPLACE TRIGGER CHECK_SEC_BI
BEFORE INSERT ON PROFILE
FOR EACH ROW
BEGIN
IF :NEW.DEFAULT_RIGHTS:=1
THEN
INSERT INTO SECURITY (THING, PERSONORGROUP, ACCESSRIGHTS)
VALUES
NEW.SYSTEM_ID, 1, 255)
ELSE
IF :NEW.DEFAULT_RIGHTS<>1
THEN
:NEW.DEFAULT_RIGHT:=1
INSERT INTO SECURITY (THING, PERSONORGROUP, ACCESSRIGHTS)
VALUES
NEW.SYSTEM_ID, :NEW.TYPIST , 255);
INSERT INTO SECURITY (THING, PERSONORGROUP, ACCESSRIGHTS)
VALUES
NEW.SYSTEM_ID, 1, 255);
END IF;
END;
What am I doing wrong here!
I am new to the Oracle world and I need to create a trigger but I am having a problem with it. The trigger I need as to verify a value in my table 1 and if that value is null or set to 0 than I need to change the value to 1 and verify if my table 1 already have information it it, referencing the ID of the first table.
Here is what I am trying to place in.
CREATE OR REPLACE TRIGGER CHECK_SEC_BI
BEFORE INSERT ON PROFILE
FOR EACH ROW
BEGIN
IF :NEW.DEFAULT_RIGHTS:=1
THEN
INSERT INTO SECURITY (THING, PERSONORGROUP, ACCESSRIGHTS)
VALUES
ELSE
IF :NEW.DEFAULT_RIGHTS<>1
THEN
:NEW.DEFAULT_RIGHT:=1
INSERT INTO SECURITY (THING, PERSONORGROUP, ACCESSRIGHTS)
VALUES
INSERT INTO SECURITY (THING, PERSONORGROUP, ACCESSRIGHTS)
VALUES
END IF;
END;
What am I doing wrong here!