我正在尝试触发更新Video表。我得到了这一点,通过谷歌和其他任何东西,但似乎无法找到所有这些错误的答案任何帮助或建议将不胜感激。这是错误的触发器。
CREATE or REPLACE Trigger Available_Rule
BEFORE INSERT ON Transaction
FOR EACH ROW
BEGIN
SELECT (*)
FROM Video, Transaction
WHERE Status = :new.Status;
IF :new.Date_Rented_Out is not null AND IF :new.Date_Returned = NULL
THEN
UPDATE Video
set Status = Unavailable
where Status = :new.Status;
End IF;
END;
/
show errors;
2/1 PL/SQL: SQL Statement ignored
2/9 PL/SQL: ORA-00936: missing expression
4/16 PLS-00049: bad bind variable 'NEW.STATUS'
6/42 PLS-00103: Encountered the symbol "IF" when expecting one of the following: ( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg coun t current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal w ith character set specification> <a number> <a single-quoted S QL string> pipe <an alternatively-quoted string literal with c haracter set specification> <an alternatively-quoted
10/19 PLS-00049: bad bind variable 'NEW.STATUS'
12/5 PLS-00103: Encountered the symbol "end-of-file" when expecting on e of the following: end not pragma final instantiable order o verriding static member constructor map
答案 0 :(得分:1)
改变这个:
IF :new.Date_Rented_Out is not null AND IF :new.Date_Returned = NULL
到此:
IF :new.Date_Rented_Out is not null AND :new.Date_Returned is NULL
失去= NULL
和额外的IF