Oracle数据库触发器上的编译错误

时间:2017-12-11 18:46:45

标签: oracle plsql database-trigger ora-00923

我一直在尝试为我的表编译此触发器,并且我继续收到此错误:

错误消息

 Compilation failed, line 4 (19:39:58) The line numbers associated with
 compilation errors are relative to the first BEGIN statement. This
 only affects the compilation of database triggers. PL/SQL: ORA-00923:
 FROM keyword not found where expected

 Compilation failed, line 4
 (19:39:58) The line numbers associated with compilation errors are
 relative to the first BEGIN statement. This only affects the
 compilation of database triggers. PL/SQL: SQL Statement ignored

这是我的 触发器

Create or Replace Trigger NEWSALARY 
  before insert or update on CREW
  for each row
Declare 
  v_emphours AIRPLANE. EMPWORKINGHOURS%TYPE;
Begin
  select EMPWORKINGHOURS into v_ emphours 
    from "AIRPLANE" 
   where  AIRPLANEID =:NEW."AirPlaneID";
  if v_emphours > 8 then 
   :NEW."Salary":= :NEW."Salary"* 50;
  end if;
End;

1 个答案:

答案 0 :(得分:2)

声明部分有一个空格(下面是灰色的一个字符长度区域)

  

v_emphours AIRPLANE。 EMPWORKINGHOURS%TYPE;

在这里

  

v _ emphours

删除这些空格并删除无用的引用,您可以运行此语句而不会出现错误:

create or replace TRIGGER  NEWSALARY 
before insert or update on CREW
for each row
Declare 
v_emphours AIRPLANE.EMPWORKINGHOURS%TYPE;
BEGIN
select EMPWORKINGHOURS into v_emphours from AIRPLANE Where  AIRPLANEID =:NEW.AirPlaneID;
if 
v_emphours > 8
then 
:NEW.Salary:= :NEW.Salary* 50;
END IF;
End;