Scripting around DBMS_SCHEDULER.SET ATTRIBUTE
BaffyJan 18 2011 — edited Jan 18 2011All,
I'm currently assigning all scheduled jobs in my database to a newly created job class. the following works without problems:
dbms_SCHEDULER.SET_ATTRIBUTE(
name => 'scott.large_withrawals_rep',
attribute => 'job_class',
value => 'p1_plan_class');
The problem is I have about 100 jobs and several databases to implement this on, meaning I have to do this about 100 times (for each job) for each database. I have therefore tried putting this into a script as follows:
Declare
sql_string varchar2(1000);
Begin
for v_job in
(select owner||'.'||job_name
from dba_scheduler_jobs
where enabled='TRUE'
and owner !='SYS')
loop
sql_string:= q'{dbms_SCHEDULER.SET_ATTRIBUTE(
name => '||v_job||',
attribute => 'job_class',
value => 'batch_plan_class');}'
execute immediate sql_string;
end loop;
end;
=========
When I try to execute the above script, I get the follwoing error:
execute immediate sql_string;
*
ERROR at line 16:
ORA-06550: line 16, column 1:
PLS-00103: Encountered the symbol "EXECUTE" when expecting one of the
following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
Any help would be much appreciated.
Thanks in advance.
Baffy