db note trigger
db note trigger
1. This trigger sets the tournament_type column in the info table based on the
tournament_id provided in the new row.
----------------------------------------------------------------
2. This trigger records changes to the organizer table, capturing the old and new
values of organizer_name and tournament_id.
---------------------------------------------------------------
3. This trigger checks whether the TOURNAMENT_ID provided in the ORGANIZER table
exists in the TOURNAMENT table before insertion or update.
IF v_tournament_count = 0 THEN
RAISE_APPLICATION_ERROR(-20001, 'Invalid tournament ID. this tournament
id is not exist on the Tournament table so Cannot insert or update organizer.');
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE = -20001 THEN
RAISE;
END IF;
END;
---------------------------------------------------------------
4. This trigger generates a new TOURNAMENT_ID before insertion into the Tournament
table.