exo 4 CREATE OR REPLACE TRIGGER plafond_operations BEFORE INSERT ON operations FOR EACH ROW DECLARE v_montant_total NUMBER; BEGIN -- Calculer le montant total des opérations pour le mois en cours SELECT SUM(montant) INTO v_montant_total FROM operations WHERE employee_id = :NEW.employee_id AND EXTRACT(MONTH FROM date_operation) = EXTRACT(MONTH FROM SYSDATE) AND EXTRACT(YEAR FROM date_operation) = EXTRACT(YEAR FROM SYSDATE); -- Vérifier si le montant total des opérations dépasse le plafond IF v_montant_total + :NEW.montant > 1000000 THEN RAISE_APPLICATION_ERROR(-20001, 'Les opérations mensuelles sont plafonnées à 1 million FCFA.'); END IF; END; / ------------------------------ exo 5 CREATE OR REPLACE TRIGGER verifier_date_operation BEFORE INSERT ON operations FOR EACH ROW DECLARE v_date_creation DATE; BEGIN -- Récupérer la date de création du compte client SELECT date_creation INTO v_date_creation FROM clients WHERE client_id = :NEW.client_id; -- Vérifier si la date de l'opération est antérieure à la date de création du compte IF :NEW.date_operation < v_date_creation THEN RAISE_APPLICATION_ERROR(-20002, 'La date de l''opération est antérieure à la date de création du compte client.'); END IF; END; / --------------------------- exo 6 CREATE OR REPLACE PACKAGE operations_package AS PROCEDURE plafond_operations; PROCEDURE verifier_date_operation; -- Autres procédures ou fonctions nécessaires END operations_package; / CREATE OR REPLACE PACKAGE BODY operations_package AS PROCEDURE plafond_operations IS BEGIN -- Code du déclencheur plafond_operations -- (copier le code du déclencheur ici) END plafond_operations; PROCEDURE verifier_date_operation IS BEGIN -- Code du déclencheur verifier_date_operation -- (copier le code du déclencheur ici) END verifier_date_operation; -- Autres procédures ou fonctions nécessaires END operations_package; /