嗨,我是 plsql 的新手,这是我第一次使用 plsql
我使用 plsql 创建了触发器。这是我用来创建该触发器的语法。但它给出了一个错误“ [Err] ORA-24344: success with compilation error
”我无法弄清楚我哪里出错了。在这个触发器中,我使用带有光标的 for 循环。我认为那个光标有问题 谁能帮我弄清楚我哪里出错了。我使用 Navicat 来执行此操作。我为此苦苦挣扎了将近 5 天 :( 在此先感谢
CREATE OR REPLACE TRIGGER "c"
AFTER INSERT ON "EMP_REPORT_TO"
REFERENCING OLD AS "OLD" NEW AS "NEW"
FOR EACH ROW
DECLARE
miclaim_supervisor_count number;
employee_company_code number;
employee_businessunit number;
cursor projMgrsCursor is select b.BU_MEMBER_ID
from BU_MEMBER b, EMP_SUB_DIV s
where s.EMP_NO = :NEW.EMP_NO
and s.SUB_DIVISION_CODE = '02' and s.DIV_CODE = '041'
and b.BU_ID IN (select BU_ID from BU_MEMBER where BU_MEMBER_ID = :NEW.EMP_NO);
BEGIN
delete from MICL_SUPERVISORS where EMP_NO = :NEW.EMP_NO and IS_OVVERRIDDEN = 0;
select count(*) into miclaim_supervisor_count from MICL_SUPERVISORS where EMP_NO = :NEW.EMP_NO and IS_OVVERRIDDEN = 1;
select COMPANY_CODE into employee_company_code from EMPLOYEE_MASTER where EMP_NO = :NEW.EMP_NO;
if (employee_company_code = 'SOFT')then
OPEN projMgrsCursor;
FOR projMgrsCursor IN projMgrs
LOOP
insert into MICL_SUPERVISORS VALUES ((:NEW.ID), (SELECT SYSDATE FROM DUAL), :NEW.ENTRYADDEDBY_EMP_NO, 3000, 0, projMgrEmpNo, NULL,:NEW.EMP_NO);
END LOOP;
close projMgrsCursor;
else
if(miclaim_supervisor_count IS NULL or miclaim_supervisor_count<1) then
insert into MICL_SUPERVISORS VALUES ((:NEW.ID), (SELECT SYSDATE `enter code here`FROM DUAL), :NEW.ENTRYADDEDBY_EMP_NO, 3000, 0, :NEW.SUP_EMP_NO, NULL,:NEW.EMP_NO);
end if;
end if;
END;
;