Is It Possible To Assign Chain Parameters To A Scheduler Job? (Doc ID 1272728.1)

Last updated on DECEMBER 06, 2016

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.4 to 11.1.0.7 [Release 10.2 to 11.1]
Information in this document applies to any platform.

Goal

Question:
Is it possible that chain parameters can be inherited to a job ?

Answer:
It is not possible that a chain set values which the job will inherit.
The only way is using metadata with using DEFINE_METADATA_ARGUMENT Procedure.
This procedure defines a special metadata argument for the program. The Scheduler can pass Scheduler
metadata through this argument to your stored procedure or other executable. You cannot set values for jobs
using this argument.

Syntax

DBMS_SCHEDULER.DEFINE_METADATA_ARGUMENT (
program_name IN VARCHAR2,
metadata_attribute IN VARCHAR2,
argument_position IN PLS_INTEGER,
argument_name IN VARCHAR2 DEFAULT NULL);



The 'metadata_attribute' is the metadata to be passed.
Valid Metadata Attributes are: 'job_name', 'job_subname', 'job_owner', 'job_start',
'window_start', 'window_end', and 'event_message'.

The  Metadata Attribute 'job_subname' is the subname of the currently running job.
The name + subname form a unique identifier for a job that is running a chain step.
NULL if the job is not part of a chain.

For more information about Metadata Attributes, see  the documentation:

Oracle� Database PL/SQL Packages and Types Reference
10g Release 2 (10.2)
Part Number B14258-02


For chains, the steps must point to programs and can't have arguments.
So create a program which has a single metadata argument. 
Use the 'job_subname', then you can point a step to that program.
The scheduler will automatically set the value of this argument to the stepname and
your stored procedure can then use the stepname to do whatever it wants.




Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms