title: Oracle update statement with analytics is failing
body: <p>The Table_B contains duplicate records as seen below. What I am trying to do is lookup Table_A using Table_B.SERIAL_NUM and update Table_A .COVERAGE_END coloumn with the most recent Date value in COVERAGE_TO coloumn in Table_B.</p>
  
  <h2>Table_B</h2>
  
  <pre><code>SERIAL_NUM  ,COVERAGE_FROM  ,COVERAGE_TO 
  123456  ,26/12/2014 ,13/12/2015
  123456  ,14/12/2015 ,13/12/2016
  23456   ,18/12/2014 ,13/12/2015
  23456   ,14/12/2015 ,13/12/2016
  </code></pre>
  
  <p>Following is the update statement I am using.</p>
  
  <pre><code>update Table_A J
  set ( J.COVERAGE_END_DATE)
  =(select COVERAGE_TO from 
  (
  select SERIAL_NUM, COVERAGE_TO, row_number() over(partition by SERIAL_NUM order by COVERAGE_TO desc) as rn from  TABLE_B B
  
  )where rn = 1
  )
  where exists
  (
  select * from TABLE_B Q where Q.SERIAL_NUM = J.SERIAL_NUMBER
  )
  ;
  </code></pre>
  
  <p>However I get the following error</p>
  
  <pre><code>ORA-01427: single-row subquery returns more than one row
  </code></pre>
  
  <p>Can Some one please help me with this Query?</p>