2

When attempting to compile I am getting the following errors

Error(16,8): PLS-00103: Encountered the symbol "SPROLLUPEXPENSEITEM" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "SPROLLUPEXPENSEITEM" to continue.

and

Error(17,15): PLS-00103: Encountered the symbol "=" when expecting one of the following: . ( * @ % & = - + < / > at in is mod remainder not rem then <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset

create or replace
TRIGGER tr_ExpenseItem_Rollup
AFTER DELETE OR UPDATE of ExpApprAmt
ON ExpenseItem
FOR EACH ROW
DECLARE
    RollupAmt   Number;
    BlnResult   Boolean;
BEGIN
    IF DELETING THEN
        RollupAmt := -1 * :Old.ExpApprAmt;
    End If;
    IF UPDATING Then
        RollupAmt := :New.ExpApprAmt - :Old.ExpApprAmt;
    End IF;
  Call spRollUpExpenseItem(:New.ERNo,:New.ECNo,RollupAmt,BlnResult);
    If BlnResult := TRUE
        --Additional Logic Here 
    End IF;
END;

I'm a student and very new at this, so any help would be appreciated.

Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
Little Foye
  • 23
  • 1
  • 3

2 Answers2

5

call isn't a keyword in PL/SQL and to run a stored procedure you just use its name. Remove call from before spRollUpExpenseItem:

create or replace
TRIGGER tr_ExpenseItem_Rollup
AFTER DELETE OR UPDATE of ExpApprAmt
ON ExpenseItem
FOR EACH ROW
DECLARE
    RollupAmt   Number;
    BlnResult   Boolean;
BEGIN
    IF DELETING THEN
        RollupAmt := -1 * :Old.ExpApprAmt;
    End If;
    IF UPDATING Then
        RollupAmt := :New.ExpApprAmt - :Old.ExpApprAmt;
    End IF;
    spRollUpExpenseItem(:New.ERNo,:New.ECNo,RollupAmt,BlnResult);
    If BlnResult = TRUE Then
        --Additional Logic Here 
    End IF;
END;
William Robertson
  • 15,273
  • 4
  • 38
  • 44
John Doyle
  • 7,475
  • 5
  • 33
  • 40
3

I believe your problem is in the last if statement. You're missing Then and you're using := which is the assignment operator, you should use = instead.

If BlnResult = TRUE Then

or just

If BlnResult Then
Terkel
  • 1,575
  • 8
  • 9