1

i have the job in my PLSQL package & its returning jobno when i debug , how this job number generated ?

 DBMS_JOB.SUBMIT(jobNo, 'begin AsyncContractInvDet_pkg. async_response(JOB); end;');
log_debug('jobNo::::'||jobNo);

How to write equivalent DBMS_scheduler.create for above job and where i can pass jobno as in parameter because my pkg.proc having in parameter

chiranth
  • 31
  • 2
  • Is the need for the procedure you are calling with the job to know what job it's being run by? – Paul W Feb 01 '23 at 13:17

1 Answers1

0

Why does it matter how the number is generated by DBMS_JOB? The only thing that matters is that it is unique.

DBMS_SCHEDULER doesn't use job numbers at all: it identifies jobs by name that you provide and does not generate the identifier for you. See the documentation here for equivalent examples. Scheduled jobs are treated just like other database objects, and in most cases should not be created dynamically. Each job should be defined statically as part of your schema DDL, and only executed dynamically.

You will need to modify your DDL to create named jobs once, just like any other package or stored procedure, then modify your code to use DBMS_SCHEDULER.RUN_JOB to execute jobs by name.

pmdba
  • 6,457
  • 2
  • 6
  • 16