title: Oracle - Sorting a VARCHAR2 field like a NUMBER - I found a solution, need explanation on it
body: <p>I have a VARCHAR2 column that I want to sort numerically.  99% (or possibly even 100%) of the time it will contain numbers.  I was looking around and found <a href="http://www.techonthenet.com/oracle/questions/sort1.php">this solution</a>.  Quoting the source:</p>
  
  <blockquote>
    <p>Remember that our goal is to sort the supplier_id field in ascending order (based on its 
    numeric value). To do this, try using
    the LPAD function.</p>
    
    <p>For example,</p>
    
    <p>select * from supplier order by
    lpad(supplier_id, 10);</p>
    
    <p>This SQL pads the front of the
    supplier_id field with spaces up to 10
    characters. Now, your results should
    be sorted numerically in ascending
    order.</p>
  </blockquote>
  
  <p>I've played around a little bit with this solution and it seems to be workign (so far), but <strong>how</strong> does it work, can anyone explain?</p>