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;
/