[英]ORA-00936: missing expression (sql-oracle)
I want to add 100 dollars to the old money, But tell me ORA-00936: missing expression 我想在旧钱中增加100美元,但请告诉我ORA-00936:缺少表达
create table sala(
salary char(4));
insert into sala values(300);
create or replace trigger update_sal
after insert on sala
for each row
when(new.salary in not null)
begin
update sala set salary=new.salary + 100;
end;
The trigger syntax is not correct. 触发语法不正确。
Try this: 尝试这个:
create or replace trigger update_sal
before insert on sala
for each row
begin
if :new.salary is not null then
:new.salary := :new.salary + 100;
end if;
end;
Key points: 关键点:
:NEW
value in an after
trigger. after
触发器中修改:NEW
值。 You can do so in a before
trigger though. before
触发before
执行此操作。 :NEW
:NEW
After adding this trigger, here is the result: 添加此触发器后,结果如下:
insert into sala values(700);
select * from sala;
800
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.