This is the trigger:
create trigger T_Noleggio
after insert on Noleggio
for each row
begin
IF((:new.codcliente=prenotazione.codcliente)&&(:ne w.codfilm=prenotazione.codfilm)
&&(:new.codnegozio=prenotazione.codnegozio)
delete prenotazione
end
what's the problem??
Thank, you Elisa
The table Prenotazione is:
CREATE TABLE Prenotazione
(CodFilm NUMBER(10) NOT NULL,
CodNegozio NUMBER(10) NOT NULL,
CodCliente VARCHAR(10) NOT NULL,
Data_Prenotazione date NOT NULL,
Supporto VARCHAR2(3) NOT NULL,
PRIMARY KEY(CodFilm,CodNegozio,CodCliente,Data_Prenotazion e),
FOREIGN KEY(CodNegozio)
REFERENCES Negozio(IdNegozio)
ON DELETE CASCADE,
FOREIGN KEY(CodFilm)
REFERENCES Film(IdFilm)
ON DELETE CASCADE,
FOREIGN KEY(CodCliente)
REFERENCES Cliente(User_id)
ON DELETE CASCADE)
and the table noleggio is:
CREATE TABLE Noleggio
(CodFilm NUMBER(10) NOT NULL,
CodNegozio NUMBER(10) NOT NULL,
CodCliente VARCHAR(10) NOT NULL,
Data_Noleggio date NOT NULL,
Supporto VARCHAR2(3) NOT NULL,
PRIMARY KEY(CodFilm,CodNegozio,CodCliente,Data_Noleggio),
FOREIGN KEY(CodNegozio)
REFERENCES Negozio(IdNegozio)
ON DELETE CASCADE,
FOREIGN KEY(CodFilm)
REFERENCES Film(IdFilm)
ON DELETE CASCADE,
FOREIGN KEY(CodCliente)
REFERENCES Cliente(User_id)
ON DELETE CASCADE)