I have a table of about a million rows, and I need to update each row of the table with the result of a long calculation (the calculation gets a potentially excellent result for each row). Since this is time consuming, the database administrator must be able to control the execution. This specific calculation needs to be run once a year (it is a summary at the end of the year). I wanted to create a job using DBMS_SCHEDULER.CREATE_JOB, which would capture 100 rows from a table, update them, and then stop them; The next task execution then takes away the place where the previous execution was terminated.
My first thought was to include this code at the end of my stored procedure:
-- update 100 rows, storing the primary key of the last -- updated row in last_id -- make a new job that will run in about a minute and will -- start from the primary key value just after last_id dbms_scheduler.create_job ( job_name=>'yearly_summary' , job_type=>'STORED_PROCEDURE' , job_action=>'yearly_summary_proc(' || last_id || ')' , start_date=>CURRENT_TIMESTAMP + 1/24/60 , enabled=>TRUE );
But I get this error while executing the stored procedure:
ORA-27486: insufficient privileges ORA-06512: at "SYS.DBMS_ISCHED", line 99 ORA-06512: at "SYS.DBMS_SCHEDULER", line 262 ORA-06512: at "JBUI.YEARLY_SUMMARY_PROC", line 37 ORA-06512: at line 1
Suggestions for other ways to do this are welcome. I would prefer to use DBMS_SCHEDULER, and I would prefer not to create any tables; why am I passing last_id to a stored procedure.
source share