0

我一直在尝试为我的表编译这个触发器,但我不断收到这个错误:

错误信息

 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;

​</p>

4

1 回答 1

2

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

v_emphours 飞机。工作时间%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;
于 2017-12-11T18:49:03.037 回答