Reasons to set job arguments - Oracle DBA

Q.  After creating a job, you may need to set job arguments if-
- Published on 13 Aug 15

a. The inline job action is a stored procedure or other executable that requires arguments.
b. The job references a named program object and you want to override one or more default program arguments.
c. The job references a named program object and one or more of the program arguments were not assigned a default value.
d. All mentioned above.

ANSWER: All mentioned above.
 

    Discussion

  • Nirja Shah   -Posted on 30 Sep 15
    - After creating a job, you may need to set job arguments if:

    1. The inline job action is a stored procedure or other executable that requires arguments

    2. The job references a named program object and you want to override one or more default program arguments

    3. The job references a named program object and one or more of the program arguments were not assigned a default value

    - To set job arguments, use the SET_JOB_ARGUMENT_VALUE or SET_JOB_ANYDATA_VALUE procedures or Enterprise Manager.

    - SET_JOB_ANYDATA_VALUE is used for complex data types that cannot be represented as a VARCHAR2 string.

    - An example of a job that might need arguments is one that starts a reporting program that requires a start date and end date.

    - The following code example sets the end date job argument, which is the second argument expected by the reporting program:

    BEGIN
    DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
    job_name => 'ops_reports',
    argument_position => 2,
    argument_value => '12-DEC-03');
    END;
    /

    - If you use this procedure on an argument whose value has already been set, it will be overwritten.

    - You can set argument values using either the argument name or the argument position.

    - To use argument name, the job must reference a named program object, and the argument must have been assigned a name in the program object.

    - If a program is inlined, only setting by position is supported. Arguments are not supported for jobs of type plsql_block.

    - To remove a value that has been set, use the RESET_JOB_ARGUMENT procedure.

    - This procedure can be used for both regular and ANYDATA arguments.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)