Home > database >  Oracle triggers
Oracle triggers

Time:09-21

Oracle 12 c
I set the following triggers in

The CREATE OR REPLACE the TRIGGER MY_TGR_1
BEFORE the INSERT ON TAB_USER
FOR EACH ROW
DECLARE
NEXT_UUID NUMBER;
The BEGIN
NEXT_UUID=1;
: NEW UUID:=NEXT_UUID;
END;

Table structure as



After an insert statement
INSERT INTO "test" (" name ") VALUES (' Chen ');

An error
ORA - 04098: the trigger 'test. TRI_TEST' is invalid and failed re - validation

CodePudding user response:

You trigger at this table TAB_USER,
You forget to test the insert data is what oh

CodePudding user response:

Oracle trigger

http://www.verejava.com/? Id=17173797331956

CodePudding user response:

The trigger table is wrong

CodePudding user response:

Oh oh thank you oh, I'll go and see

CodePudding user response:

Trigger is wrong, you trigger inserted again for the first data
NEXT_UUID=1; Instead of
NEXT_UUID:=1;
But the second UUID is empty words will be reported to the primary key conflict, consider using sequence
  • Related