oracle - 尝试调用过程时的 PLS-00103

标签 oracle plsql triggers pls-00103

尝试编译时出现以下错误

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

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;

我是一名学生,并且对此非常陌生,因此我们将不胜感激。

最佳答案

call 不是 PL/SQL 中的关键字,要运行存储过程,您只需使用它的名称。删除 spRollUpExpenseItem 之前的 call:

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;

关于oracle - 尝试调用过程时的 PLS-00103,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9253520/

相关文章:

sql - 使用列值的排列

oracle - 创建索引是否应该立即更新 Oracle 查询计划?

oracle - Initcap 跳过小于 4 个字符的单词

Oracle PL-SQL : insert a rowtype after select - no enough values

string - Oracle函数返回字符串之间的相似度

android - 为什么我的听众触发快乐

sql - 使用 mybatis 从 Oracle DB 中选择 BLOB 列

php - 连接到 Oracle : CodeIgniter vs Laravel

sql - 多个触发器与单个触发器

database - PostgreSQL - 检查两个属性中的值是否相等