0

I have been trying to compile this trigger for my table and I keep on getting this error:

Error message :

 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

This is my Trigger :

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 Answer 1

2

there's a space in declaration part(grey one character-length area below)

v_emphours AIRPLANE.EMPWORKINGHOURS%TYPE;

and here

v_emphours

get rid of those spaces and removing useless quotations, you may run this statement without error :

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.