在触发器触发期间,必须执行两个包。在第一次打包1时遇到ORA-6502: PL/SQL: numeric or value error
。
包SETFLELDRC
已成功编译,在触发器外执行时确实有效!
根本不执行包的代码。
守则
DROP TRIGGER SETPROC.SLCFILEARRIVE_TRG;
创建包到这里
CREATE OR REPLACE TRIGGER SETPROC.SLCFILEARRIVE_TRG
BEFORE INSERT OR UPDATE
ON SET_LOADER_CNTL
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
v_MAIN_LODR_APP VARCHAR2(30) := Null;
v_RECEIVE_FILENAME VARCHAR2(20) := Null;
v_FILETYPE_HSCT_VLI VARCHAR2(01) := 'N';
v_SERVICE VARCHAR2(04) := Null;
v_SUBSERVICE VARCHAR2(05) := Null;
v_Centre VARCHAR2(03) := Null;
v_Currency VARCHAR2(03) := Null;
v_servcntl_prddate VARCHAR2(08) := Null;
v_servcntl_serv VARCHAR2(08) := 'SET';
v_prg VARCHAR2(10) := RPAD(REPLACE('SLCFLEARRV','x',' '),10,' ');
v_vrs VARCHAR2(02) := '04';
v_spo VARCHAR2(03) := 'SET';
v_spomsg VARCHAR2(200) := Null;
v_loader_parameter VARCHAR2(50) := Null;
v_loader_parameter1 VARCHAR2(50) := Null;
v_loader_parameter2 VARCHAR2(50) := Null;
v_trace VARCHAR2(06) := Null;
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = ''YYYYMMDD''';
:NEW.SERVICE := RTRIM(:NEW.SERVICE);
:NEW.SUB_SERVICE := RTRIM(NVL(:NEW.SUB_SERVICE,'NONE'));
v_SERVICE := RTRIM(:NEW.SERVICE);
v_SUBSERVICE := RTRIM(:NEW.SUB_SERVICE);
v_trace := 'SLC002';
v_MAIN_LODR_APP := RTRIM(:NEW.MAIN_LODR_APP);
v_trace := 'SLC003';
v_RECEIVE_FILENAME := RTRIM(:NEW.RECEIVE_FILENAME);
v_trace := 'SLC004';
v_FILETYPE_HSCT_VLI := :NEW.FILETYPE_HSCT_VLI;
v_Centre := :NEW.CENTRE;
v_Currency := :NEW.CURRENCY;
IF :NEW.FILE_ARRIVED = 'Y' AND NVL(:OLD.FILE_ARRIVED,'N') <> 'Y' then
--Call to First Package ... FAILS HERE...
SETFLELDRC.Main_Process(v_SERVICE,
v_SUBSERVICE,
v_Centre,
v_Currency,
v_RECEIVE_FILENAME,
v_FILETYPE_HSCT_VLI
);
v_trace := 'SLC06e';
:NEW.FILETYPE_HSCT_VLI := v_FILETYPE_HSCT_VLI;
v_trace := 'SLC06f';
v_spomsg := 'Loader Completed for ('||v_SERVICE||' '||v_SUBSERVICE
||' '||v_Centre||' '||v_Currency
||' '||v_RECEIVE_FILENAME||') - Status = ('||v_FILETYPE_HSCT_VLI||')';
Spo_Write(v_prg, v_spo, v_vrs, v_spomsg);
END IF;
v_trace := 'SLC06g';
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20310,SQLERRM||'SLCFILEARRIVE Trigger ERROR');
END;
/