title: How to concatenate column values in oracle based on other column value?
body: <p>I have some data in table like:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>CSF</th>
  <th>ID</th>
  <th>seqNum</th>
  <th>Data</th>
  <th>rs_id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>1</td>
  <td>14176159</td>
  <td>1</td>
  <td>ABC</td>
  <td>0x000055.0001882a.017c</td>
  </tr>
  <tr>
  <td>1</td>
  <td>14176160</td>
  <td>2</td>
  <td>DEF</td>
  <td>0x000055.0001882c.0010</td>
  </tr>
  <tr>
  <td>1</td>
  <td>14176161</td>
  <td>3</td>
  <td>GHI</td>
  <td>0x000055.0001882d.00ac</td>
  </tr>
  <tr>
  <td>1</td>
  <td>14176162</td>
  <td>4</td>
  <td>JKL</td>
  <td>0x000055.0001882d.0164</td>
  </tr>
  <tr>
  <td>0</td>
  <td>14176163</td>
  <td>5</td>
  <td>MNO</td>
  <td>0x000055.0001882f.001c</td>
  </tr>
  <tr>
  <td>0</td>
  <td>14176163</td>
  <td>1</td>
  <td>ABC</td>
  <td>0x000055.0001882f.00d4</td>
  </tr>
  <tr>
  <td>1</td>
  <td>14176164</td>
  <td>1</td>
  <td>ABC</td>
  <td>0x000055.00018830.0144</td>
  </tr>
  <tr>
  <td>1</td>
  <td>14176165</td>
  <td>2</td>
  <td>DEF</td>
  <td>0x000055.00018831.0010</td>
  </tr>
  <tr>
  <td>1</td>
  <td>14176166</td>
  <td>3</td>
  <td>GHI</td>
  <td>0x000055.00018832.00e4</td>
  </tr>
  <tr>
  <td>1</td>
  <td>14176166</td>
  <td>4</td>
  <td>JKL</td>
  <td>0x000055.00018832.019c</td>
  </tr>
  <tr>
  <td>0</td>
  <td>14176167</td>
  <td>5</td>
  <td>MNO</td>
  <td>0x000055.00018834.001c</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I want to execute select in a way to obtain the result as:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>CSF</th>
  <th>ID</th>
  <th>seqNum</th>
  <th>Data</th>
  <th>rs_id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>0</td>
  <td>14176159</td>
  <td>5</td>
  <td>ABCDEFGHIJKLMNO</td>
  <td>0x000055.0001882f.001c</td>
  </tr>
  <tr>
  <td>0</td>
  <td>14176163</td>
  <td>1</td>
  <td>ABC</td>
  <td>0x000055.0001882f.00d4</td>
  </tr>
  <tr>
  <td>0</td>
  <td>14176164</td>
  <td>5</td>
  <td>ABCDEFGHIJKLMNO</td>
  <td>0x000055.00018834.001c</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>So the logic should work like:</p>
  <ol>
  <li>whenever CSF encountered is 1, we need to append data column until CSF is 0.</li>
  <li>In the result, the ID should be of the record where CSF was first encountered as 1.</li>
  <li>In the result, the SeqNum and rs_id should be of the record where CSF is 0.</li>
  </ol>
  <p>So in short, CSF 1  indicates that data column is appended in next record and 0 indicates that the data column is not further split in to records and is an independent record.</p>