I have a table in Oracle that contains some tasks and their dependent tasks. Some sample data.
Dependent Task | Task |
---|---|
TASK3 | TASK2 |
TASK1 | TASK5 |
TASK2 | TASK5 |
TASK4 | TASK3 |
The dependent task must always finish before the Task I want to generate an order of the above tasks like the following which the correct order of task execution:
All_Tasks_Ordered |
---|
TASK1 |
TASK2 |
TASK5 |
TASK4 |
TASK3 |
Please can you provide a way to achieve this? I suppose i have to use CONNECT BY clause but i am not sure how to do this. Thanks in Advance.
The sample data you provided is ambiguous and does not align with the outcome you desire or have specified.
Generally speaking, the clause:
CONNECT BY PRIOR Task = DependentTask
ORDER SIBLINGS BY Task;
is correct in principle, but it is uncertain whether it would be appropriate for your particular scenario given the issues outlined above.