title: Calculating minimum distance between two cities with pl/sql
body: <p>I need to be able to calculate the minimum distance between two cities given a table that has the distances between pairs of cities. Two cities may not be connected directly, instead they may be connected via a third city and so on.</p>
  
  <p>Here are the tables that I have</p>
  
  <pre><code>SQL&gt; desc city
   Name                                      Null?    Type
   ----------------------------------------- -------- ------------
  
   CITY_ID                                   NOT NULL NUMBER
   CITY_NAME                                 NOT NULL VARCHAR2(80)
   CITY_STATE                                         VARCHAR2(80)
   ACTIVE                                             CHAR(1)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SQL&gt; desc connection
   Name                                      Null?    Type
   ----------------------------------------- -------- -------
  
   CITY1                                     NOT NULL NUMBER
   CITY2                                     NOT NULL NUMBER
   NO_OF_DAYS                                NOT NULL NUMBER
  </code></pre>
  
  <p>I don't know how recursion and backtracking work in pl/sql.</p>