Skip to content
Advertisement

trigger created but when executed showing some errors==> ORA-04091:, ORA-06512:, ORA-04088:

I have a table called movie_cast.

This table already has duplicate values(#114). act_id, mov_id are foreign keys. And I’ve created a trigger on movie_cast table called trg1.

Although the trigger is been created but after execution it shows some errors

My task is: I want to allow entries in this table i.e; an actor can do more than one movie(act_id can be repetitive/duplicate) but I cannot cast same actor for same movie twice. Can somebody help me here? I’m fed up with this question from last 2 days now! Thank You!

Advertisement

Answer

As the commenters mentioned, triggers are not the right tool for preventing duplicates. You want a unique constraint for multiple columns.

This will allow duplicate MOV_ID and ACT_IDs, but not duplicate combinations of MOV_ID + ACT_ID.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement