Oracle Warning: Trigger Created With Compilation Errors
1002068Apr 9 2013 — edited Apr 9 2013I don't know what I am doing wrong here, I looked at the error, but I can't seem to figure it out.
SQL> CREATE OR REPLACE TRIGGER TRANS_AskingPriceIniValue
2 AFTER INSERT ON Transactions
3 DECLARE
4 rowcount INTEGER;
5 NetProfit NUMBER;
6 avgNetProfit NUMBER;
7 BEGIN
8 SELECT Count(*) INTO rowcount
9 FROM Transactions T
10 WHERE new.WorkID = T.WorkID;
11 IF rowcount := 1 THEN
12 new.AskingPrice = 2 * new.AquisitionPrice;
13 ELSE IF
14 rowcount > 1 THEN SELECT Sum(NetPRofit) INTO NetProfit
15 FROM ArtistWorkNetView AW
16 WHERE AW.WorkID = new.WorkID
17 GROUP BY AW.WorkID;
18 avgNetProfit = NetProfit / (rowcount - 1);
19 IF avgNetProfit > 2 * new.AcquisitionPrice THEN
20 new.AskingPrice = avgNetProfit;
21 ELSE
22 new.AskingPrice = 2 * new.AcquistionPrice;
23 END IF;
24 END IF;
25 END IF;
26 END;
27 /
Warning: Trigger created with compilation errors.
SQL> SHOW ERRORS
Errors for TRIGGER TRANS_ASKINGPRICEINIVALUE:
LINE/COL ERROR
-------- -----------------------------------------------------------------
9/13 PLS-00103: Encountered the symbol "=" when expecting one of the
following:
. ( * @ % & = - + < / > at in is mod not rem then
<an exponent (**)> <> or != or ~= >= <= <> and or like
between ||