SQL Language (MOSC)

MOSC Banner

Table with FK and INSERT/UPDATE trigger

--=== Given a table with a FK and a trigger.

--=== 1. If an INSERT/UPDATE is done that violates the FK, the trigger fires, which is not what I would expect.

--=== 2. But for MERGE, the trigger does not fire. So there is clearly an inconsistency.

--=== 3. Can you please describe this behaviour for INSERT/UPDATE, and difference between INSERT/UPDATE and MERGE.

--========== INSERT and UPDATE raise:

--==========    ORA-02291: integrity constraint (K.T2#F#1) violated - parent key not found


DROP TABLE T1 CASCADE CONSTRAINTS;

DROP TABLE T2 CASCADE CONSTRAINTS;

-- Create table t1 (will remain empty for the test)

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center