plsql中的新旧用法

plsql中的新旧用法,sql,oracle,plsql,Sql,Oracle,Plsql,有人能告诉我下面的代码是什么吗 create trigger salary_chk before update on employees for each row when (employee_id>0) declare begin if(new.salary>old.salary*1.2) signal 'You cannot do this'; end if; end; / 我得到以下错误 Error report: ORA-04076: i

有人能告诉我下面的代码是什么吗

create trigger salary_chk before update on employees for each row
when (employee_id>0)
declare
  begin
    if(new.salary>old.salary*1.2)
      signal 'You cannot do this';
    end if;
  end;
/
我得到以下错误

Error report:
ORA-04076: invalid NEW or OLD specification
04076. 00000 -  "invalid NEW or OLD specification"
*Cause:    An invalid NEW or OLD specification was given for a column.
*Action:   Re-specify the column using the correct NEW or OLD specification.

试试这个。我看不出它不应该工作的任何其他原因,因为它是PL/SQL

我认为您缺少冒号,请尝试:new.salary>:old.salary WHEN子句不使用
。别问我为什么。
create trigger salary_chk 
before update 
on employees 
for each row
when (new.employee_id > 0) -- missing new
  begin
    if( :new.salary > :old.salary*1.2) -- Missing colons
    then -- Missing then
      dbms_alert.signal('my_alert', 'You Cannot Do this');
    end if;
  end;
/
create trigger salary_chk 
before update 
on employees 
for each row
when (new.employee_id > 0) -- missing new
  begin
    if( :new.salary > :old.salary*1.2) -- Missing colons
    then -- Missing then
      dbms_alert.signal('my_alert', 'You Cannot Do this');
    end if;
  end;
/