# P_CANCEL_SAME_LOCATION_EVENTS ## Codice Sorgente ```sql PROCEDURE "P_CANCEL_SAME_LOCATION_EVENTS" (p_good_event_id number) as -- --------------------------- -- Autore: Daniele Viti -- Data: 17/01/2020 -- Descrizione: Controlla che ci siano più eventi con la stessa locazione e data di quello in esame e li annulla -- --------------------------- v_date date; v_idloc number; begin begin -- Seleziono la data e la location per confrontarle dopo select data, id_location into v_date, v_idloc from eventi where id = p_good_event_id; exception when no_data_found then raise_application_error(-20001, 'Impossibile trovare l''evento da confermare'); end; for c in ( select * from eventi where data = v_date and id_location = v_idloc and id != p_good_event_id ) loop -- Imposta l'evento come obsoleto (annullato) UPDATE EVENTI SET FLG_SUPERATO = 1, STATO = 900 WHERE ID = c.id; end loop; end;```