PLS-00103: 遇到符号“;”当期望出现以下情况之一时: . ( ) * @ % & - + /

PLS-00103: Encountered the symbol ";" when expecting one of the following: . ( ) * @ % & - + /

编译失败,第 10 行 (14:27:16)
与编译错误关联的行号是相对于第一个 BEGIN 语句的。这只影响数据库触发器的编译。

PLS-00103: 遇到符号“;”当期望出现以下情况之一时: . ( ) * @ % & - + / at mod 余数 rem with and or group having intersect minus start union where connect ||多重集 符号“;”被忽略了。**

create or replace trigger "PROMOS_T2"
  BEFORE insert or update on "PROMOS"    
  for each row    
DECLARE    
  ma_exp1 EXCEPTION;    
  ma_exp2 EXCEPTION;    
  ma_exp3 EXCEPTION;
  cap LOGTS.CAPACITE%TYPE;    
  nbr INTEGER;    
begin
  SELECT COUNT (*) INTO nbr FROM LOGTS  WHERE :NEW."IDLOG"=IDLOG;
  SELECT CAPACITE INTO cap FROM LOGTS WHERE :NEW."IDLOG"=IDLOG;
  if (exists(SELECT * FROM PROMOS WHERE :NEW."IDPROMO"=IDPROMO;) )THEN
    RAISE ma_exp1;
  elsif nbr=1 AND cap < :NEW."NBPLACES" THEN
    RAISE ma_exp2;
  else
    RAISE ma_exp3;
  end if;
EXCEPTION
  WHEN ma_exp1 THEN
    RAISE_APPLICATION_ERROR(-20004,'la promos dèja existe');
  WHEN ma_exp2 THEN
    RAISE_APPLICATION_ERROR(-20005,'PAS DE PLACE');
  WHEN ma_exp3 THEN
    RAISE_APPLICATION_ERROR(-20006,'IDLOG nexiste pas');
end;

查看错误信息,特别是部分

Compilation failed, line 10

Encountered the symbol ";"

这是第 10 行:

if (exists(SELECT * FROM PROMOS WHERE :NEW."IDPROMO"=IDPROMO;) )THEN

看到问题了吗?

您的编译错误是由该行中的分号引起的。删除它会有所帮助,但您的代码仍然无法编译,因为您无法在 SQL 之外的 PL/SQL 中调用 EXISTS。要解决这个问题,see the answers to this question.