我有一个脚本 /home/load_data.sh 我想从我的过程中运行,前提是我的 IF 语句不满足:
create or replace
PROCEDURE RD_ODS_REFRESH_LOG
IS
BEGIN
FOR i IN
(
SELECT RESULT FROM USERS
WHERE trunc(COMPLETED_DATE) = trunc(SYSDATE -1)
)
LOOP
IF i.RESULT = 'FAIL'
THEN
EMAIL
(
'ANGELINA1984@aol.com',
'daily Refresh report',
'FAILED',
'Todays daily Refresh Failed.'
);
ELSE
SYS.DBMS_SCHEDULER.create_job
(
job_name => 'RD_ODS_REFRESH_LOG',
job_action => '/home/load_data.sh',
job_type => 'executable',
number_of_arguments => 0,
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled => FALSE,
auto_drop => FALSE,
comments => 'run load data shell script'
);
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
(
name => 'RD_ODS_REFRESH_LOG',
attribute => 'logging_level', value => DBMS_SCHEDULER.LOGGING_FULL
);
SYS.DBMS_SCHEDULER.enable
(
name => 'RD_ODS_REFRESH_LOG'
);
END IF;
END LOOP;
END RD_ODS_REFRESH_LOG;
我想知道如何将所有这些放在一起,以便当不满足 IF 时,它会跳转到 ELSE 语句并执行上面的代码?
我可以使用SCHEDULER以外的其他东西吗?毕竟我想要的是能够在 ELSE 情况下运行我的 /home/load_data.sh 脚本。
我用Oracle11g...