title: Keep first parent in recursive (Start With... IN..., Connect By )
body: <p>I'm trying to keep track of the first parent given with an 'in' operator in a recursive query.</p>
  
  <p>Here is the (highly simplified ;-) ) problem:</p>
  
  <p>I have a table (myTable) with instrument interconnections like:</p>
  
  <pre>
      SENSOR_IN | SENSOR_OUT
      ----------------------
              5 |         6
              3 |         5
              7 |         8
              2 |         7
              1 |         2
  </pre>
  
  <p>From this table I want to get a connection chain with "level" like:</p>
  
  <pre>
      SELECT level, sensor_in, sensor_out
      FROM myTable
      START WITH sensor_out IN (6,8)
      CONNECT BY sensor_out = prior sensor_in
  ;
  </pre>
  
  <p>That will return me something like [didn't test, just to explain]:</p>
  
  <pre>
      LEVEL | SENSOR_IN | SENSOR_OUT
      --------------------------------
           1          5 |         6
           1          7 |         8
           2          3 |         5
           2          2 |         7
  </pre>
  
  <p>I want know add a column called, let's say "first", giving for every line who is the primary parent (so the value given in the "IN()" statement, not the "true" primary parent in the table => wich is actually always the same in my particular case). Thus something like:</p>
  
  <pre>
      LEVEL | SENSOR_IN | SENSOR_OUT | FIRST
      ---------------------------------------
           1          5 |         6  |      6
           1          7 |         8  |      8
           2          3 |         5  |      6
           2          2 |         7  |      8
  </pre>
  
  <p>Any (simple) idea?</p>
  
  <p>Remark: if someone has a simple way to return the whole chain in one line for every "first", it's even better! Something like :</p>
  
  <pre>
      FIRST | CHAIN
      -------------
          8 | 8;7;2
          6 | 6;5;3
  </pre>
  
  <p>Thanks in advance!</p>