linux时间转成成oracle,Linux下的crontab转换成Oracle的scheduler

CREATE TABLE tb_test_cron_config(position_id number,position_name varchar2(50 char),allow_value VARCHAR2(50 CHAR),special_character VARCHAR2(50 CHAR));

INSERT INTO tb_test_cron_config

VALUES(1,'秒','0-59',', - * /');

INSERT INTO tb_test_cron_config

VALUES(2,'分钟','0-59',', - * /');

INSERT INTO tb_test_cron_config

VALUES(3,'小时','0-23',', - * /');

INSERT INTO tb_test_cron_config

VALUES(4,'日期','1-31',', - * ? / L W C');

INSERT INTO tb_test_cron_config

VALUES(5,'月份','1-12',', - * /');

INSERT INTO tb_test_cron_config

VALUES(6,'星期','1-7',', - * ? / L C #');

INSERT INTO tb_test_cron_config

VALUES(7,'年(可选)','空值1970-2099',', - * /');

DECLARE

CURSOR cur_cron IS SELECT b.position_id,to_number(trim(translate(col2,b.special_character,substr(rpad(' ',length(special_character),' '),2)))) tt FROM

(Select ROWNUM ID,Regexp_Substr('0 * 14 * * ?', '[^ ]+', 1, n) col2

From dual, (Select Rownum n From dual Connect By Rownum < 100)

Where n <= length(Regexp_Replace('0 * 14 * * ?', '[^ ]', Null)) + 1) a,

tb_test_cron_config b

WHERE a.id(+)=b.position_id;

BEGIN

FOR t IN cur_cron LOOP

IF t.position_id=1 THEN

IF t.tt IS NULL

ELSIF t.position_id=2 THEN

ELSIF t.position_id=3 THEN

ELSIF t.position_id=4 THEN

ELSIF t.position_id=5 THEN

ELSIF t.position_id=6 THEN

ELSIF t.position_id=7 THEN

END IF;

END LOOP;

END;

/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值