Link to home
Start Free TrialLog in
Avatar of NikkitaKMiles
NikkitaKMiles

asked on

Oracle error ORA-00920 Invalid relational operator

I am getting an error that makes no sense to me when attempting to write a trigger.  Here is the code.  Can someone tell me why I am gettng this error?

CREATE OR REPLACE TRIGGER trg_LineTRIG
      Before INSERT ON LineDs036
     FOR EACH ROW
     Declare
      v_equip_id             sequipment.equip_id%Type;
      v_equip_sug_dep_amt    sequipment.equip_sug_dep_amt%Type;
      BEGIN
        Select equip_sug_dep_amt
   Into v_equip_sug_dep_amt
   From sequipment
   Where equip_id := Line_equip_id;
           IF :New.Line_Rent_amt > 1000 Then
           :New.Line_Rent_amt := 0;
      :New.Line_dep_amt := 0;
        ELSIF :New.Line_rent_amt >= 800 THEN
           :New.Line_Rent_amt := (:New.Line_rent_amt + (:New.Line_rent_amt * .03
));
       ELSIF :New.Line_Rent_amt >= 700 Then
           :New.Line_rent_amt := (:New.Line_rent_amt + (:New.Line_rent_amt *
.025 ));
       ELSIF :New.Line_Rent_amt >= 600 Then
         :New.Line_rent_amt := (:New.Line_rent_amt + (:New.Line_rent_amt * .02
));
       ELSIF :New.Line_rent_amt > 200 then
   equip_sug_amt :=  v_equip_sug_dep_amt;
      END IF;
    END;

ASKER CERTIFIED SOLUTION
Avatar of Agro42
Agro42

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NikkitaKMiles
NikkitaKMiles

ASKER

Nope that did not work.  I received the error:

5/9      PL/SQL: SQL Statement ignored
8/19     PL/SQL: ORA-00920: invalid relational operator
19/18    PLS-00103: Encountered the symbol "=" when expecting one of the
         following:
         := . ( @ % ;
         The symbol ":= was inserted before "=" to continue.
Agro42 is correct, it should be an "="
 
   equip_id = Line_equip_id

Are both equip_id and line_equip_id columns on the sequipment table?
From the rest of you trigger, it looks like maybe Line_equip_id shoule be :new.line_equip_id - which would also seem to make more sense in what you appear to be trying to do.

So maybe:

   equip_id = :new.Line_equip_id
I did what was asked and now I am getting this error:

19/4     PLS-00201: identifier 'EQUIP_SUG_AMT' must be declared
19/4     PL/SQL: Statement ignored
Resolved thank you.  I found the problem.
This error also included a wrong named column in the trigger.  Thanks