Tips for Enqueue

Use the CYCLE option in the definition of the recursive query if there is the possibility that the data reflecting the parent, child relationship could be cyclic, causing an infinite recursion loop. CYCLE will prevent already visited recursive key values from being put on the queue again.

Use the SEARCH option in the definition of the recursive query to return the results of the recursion in the specified parent-child hierarchical ordering. The search choices are Depth or Breadth first. Depth first means that all the descendents of each immediate child are returned before the next child is returned. Breadth first means that each child is returned before their children are returned. SEARCH requires not only the specification of the relationship keys, which columns make up the parent child relationship and the search type of Depth or Breadth but it also requires an ORDER BY clause in the main query on the provided sequence column in order to fully implement the specified ordering.