如何获取Oracle SCHEDULE 的REPEAT_INTERVAL 分钟格式?

how to get the REPEAT_INTERVAL in minutes format of Oracle SCHEDULE?

我正在使用 Oracle 11g 数据库,Oracle DB 中的重复间隔被定义为字符串格式,如 FREQ=MINUTELY; INTERVAL=10;。有什么方法可以将其转换为 +00 00:10:00.000000 这种格式吗?

使用DBMS_SCHEDULER.EVALUATE_CALENDAR_STRING和一些转换函数将日历字符串转换为间隔格式。

declare
    v_next_run_date date;
    v_start_date date := date' 2000-01-01';
    v_interval interval day(2) to second;
begin
    dbms_scheduler.evaluate_calendar_string
    (
        calendar_string   => 'FREQ=MINUTELY; INTERVAL=10;',
        start_date        => v_start_date,
        return_date_after => v_start_date,
        next_run_date     => v_next_run_date
    );

    --Convert dates to timestamps, subtraction then converts to interval.
    v_interval := 
        cast(v_next_run_date as timestamp)
        -
        cast(v_start_date as timestamp);

    dbms_output.put_line(v_interval);       
end;
/

输出:

+00 00:10:00.000000