Difference between DEFINE_CHAIN_EVENT_STEP and DEFINE_CHAIN_STEP procedure

data-warehouseetljobsoracle

As per oracle help:*

DEFINE_CHAIN_EVENT_STEP Procedure:
This procedure adds or replaces a chain step and associates it with an event schedule or an inline event. Once started in a running chain, this step will not complete until the specified event has occurred. Every step in a chain must be defined before the chain can be enabled and used. Defining a step gives it a name and specifies what happens during the step. If a step already exists with this name, the new step will replace the old one.

DEFINE_CHAIN_STEP Procedure:
This procedure adds or replaces a chain step and associates it with a program or a nested chain. When the chain step is started, the specified program or chain is run. If a step already exists with the name supplied in the chain_name argument, the new step replaces the old one.
The chain owner must have EXECUTE privileges on the program or chain associated with the step. Only one program or chain can run during a step.

Though the help documentation is elaborate, unfortunately I'm failing to understand fully. what is the difference between these two procedures?

Best Answer

First of all a chain is a name referred to a series of programs which are linked together for a specific objective.

So the DBMS_SCHEDULER.DEFINE_CHAIN_STEP procedure define an step to point to a program or a nested chain.

BUT, if you wish to define a step which waits for a event to occur to be executed then you need to use DBMS_SCHEDULER.DEFINE_CHAIN_EVENT_STEP procedure.

The following blog post from Database Journal contains a very good example of using Job Chains.

enter image description here

Figure: Flowchart is taken from database journal blog post by Jim Czuprynski.

For example, according to the above flowchart, to perform employee paycheck file validation steps it file has to be arrived. To define such step you need to user DEFINE_CHAIN_EVENT_STEP procedure.

Go to the referenced link for details.

Reference: Job Chains