title: Oracle - Return shortest string value in a set of rows
body: <p>I'm trying to write a query that returns the shortest string value in the column. For ex: if ColumnA has values ABCDE, ZXDR, ERC, the query should return "ERC". I've written the following query, but I'm wondering if there is any better way to do this?</p>
  
  <p>The query should return a single value.</p>
  
  <pre><code>select distinct ColumnA from
  (
    select ColumnA, rank() over (order by length(ColumnA), ColumnA) len_rank 
      from TableA where ColumnB = 'XXX'
  )
  where len_rank &lt;= 1
  </code></pre>