Needed a way to generate an APEX LOV(List of values) for selecting time of day to schedule a job.
The way the argument is passed to dbms_job.next_date had to deal with decimal values to indicate quarter of an hour.
e.g.
-- dbms_job.next_date(job_number,TRUNC(NEXT_DAY(SYSDATE,p_day))+p_time/24)
-- dbms_job.interval(job_number,'SYSDATE+1/24');
After fiddling with for..loop construct for some time, decided to settle for the following assuming sys.all_objects(it could be any table though as long as it has required number of rows) has enough rows, which is going to be typically higher than what is needed for this purpose.
select rownum,
rownum -1,
(rownum -1)/4,
floor((rownum-1)/4) || ':' || substr(mod(((rownum-1)*60/4), 60) || '0', 1, 2)
from sys.all_objects
where rownum <= 96;
(This is not the eventual query put in APEX LOV as it needs only two columns to be returned)
No comments:
Post a Comment