title: Help with a connect by prior query
body: <p>I have the following data</p>
  
  <pre><code>Order_ID  Pallet_ID
  O1        P1
  O2        P1
  O2        P2
  O3        P2
  O3        P3
  O4        P4
  </code></pre>
  
  <p>Where orders can be on multiple pallets, and more than one order can be on a pallet. I need to select the group of orders that make up a group, in that they all share the same group of pallets. In the test data above, there are two such groups, {O1,O2,O3} and {O4}, because O1, O2 and O3 have at least one pallet in common with another member of the group.</p>
  
  <p>Now I need some SQL to do this. I tried (where greg_test contains the data above)</p>
  
  <pre><code>select distinct order_id
  from greg_test
  start with order_id = :order_id
  connect by pallet_id = prior pallet_id
  </code></pre>
  
  <p>But that gave me a circular reference error (ORA-01436 CONNECT BY loop in user data). Adding nocycle didn't give the correct set.</p>