Reputation: 1967
I wrote this trigger to update the date of avaibility of a video when a broadcast is added
CREATE OR REPLACE TRIGGER update_avaibility
AFTER INSERT ON CAST FOR EACH ROW
DECLARE
lastCast DATE;
BEGIN
SELECT MAX(diffusionDate)
INTO lastCast
FROM CAST
WHERE idVideo = :NEW.idVideo;
UPDATE VIDEO
SET diffusionDate = (lastCast + 14 day)
WHERE idVideo = :NEW.idVideo;
END;
/
However I have the following warning when I run it :
Warning: Trigger created with compilation errors.
I have the following errors :
LINE/COL ERROR
---------- -------------------------------------
5/2 SQL Statement ignored
5/61 ORA-00907: missing right parenthesis
Can someone help me and tell me what i am doing wrong ? Thanks.
Upvotes: 0
Views: 542
Reputation: 1997
the first error is
lastCast + 14 day
if lastCast is date. you should change to
lastCast + 14
or to
lastCast + interval '14' day
Upvotes: 1