Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Scripting around DBMS_SCHEDULER.SET ATTRIBUTE

BaffyJan 18 2011 — edited Jan 18 2011
All,

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
This post has been answered by Centinul on Jan 18 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2011
Added on Jan 18 2011
4 comments
792 views