无法使用' WHEN '创建触发器


create trigger info22 after insert on table_info1 for each row 
when( :new.pid < 60 )
begin
  dbms_output.put_line(' thus the given id is less than 60');
  insert into table_info2 values(:new.pid, :new.pname, :new.ploc);
end;

当我输入上述查询时,我收到错误

ORA-25000: invalid use of bind variable in trigger WHEN clause

在引用新值时,您不需要使用分号,因为您正在这样做,Oracle 认为您正在尝试使用绑定变量。尝试键入new.而不是:new.,看看是否有帮助。

WHEN 子句中的 new/old 引用不需要冒号

改变:

when( :new.pid < 60 )

自:

when( new.pid < 60 )

最新更新