【发布时间】:2020-06-26 19:26:10
【问题描述】:
create or replace trigger newcontract
before insert on contract
declare numcon int;
for each row
begin
select contractcount
into numcon from task
where task.taskid = old.taskid;
if numcon < 3 then
insert into contract values(taskid, workerid, payment);
else
dbms_output.put_line('task is full');
end if;
end;
给出这个神秘的错误
Error(1,5): PLS-00103: Encountered the symbol "FOR" when expecting one of the following: begin function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior
如果该任务的合同计数约为 2,则不应插入插入到合同中的记录。因此,我需要检查要插入的每条记录的 contractcount 值。我使用 select 语句来获取值,但出现此错误。
【问题讨论】:
-
前一行有一个分号。我认为代码是乱序的。
-
哪一行?什么不正常?我没有发现任何问题
标签: oracle plsql oracle11g database-trigger