title: pl/sql bubble sort
body: <p>okay, I am beating myself up over this. I am need to load a array in people last name  stored in a table. Then sort the last names and print them out in alphabetical order. This must be done using the bubble sort algorithm. </p>
  
  <p>here is what I have so far</p>
  
  <pre><code>CREATE OR REPLACE PROCEDURE TEAM_TABLE_SORT AS
    TYPE player_Name_type IS TABLE OF databasename.team.player%type
    INDEX BY PLS_INTEGER ;
    player_name player_Name_type;
    i integer := 1;
    temp integer;
  
  BEGIN
  
    FOR player_names IN (SELECT * FROM marshall.team )
    LOOP
      player_name(i) := player_names.player;
      DBMS_OUTPUT.PUT_LINE(i|| ' - ' ||chr(9) || player_name(i) ) ;
      i := i + 1 ;
    END LOOP
  </code></pre>
  
  <p>All this really does is print out the names. I cannot get it to sort. I am not try thing this</p>
  
  <pre><code>TYPE player_Name_type IS TABLE OF  %type INDEX BY varchar2(20) ;
  aux player_Name_type;
  i integer := 1;
  v_current is table of aux
  swapped BOOLEAN := TRUE;
  
  BEGIN
  
    FOR aux IN (SELECT * FROM )
    LOOP
      DBMS_OUTPUT.PUT_LINE(i|| ' - ' ||chr(9) || aux.player);
      i := i + 1 ;
    END LOOP;
  
    v_current := aux.first;
    WHILE(swapped)
    LOOP
      swapped := FALSE;
  
      FOR I IN 1..(aux.count-2) LOOP
        IF aux(i) &gt; aux(I+1) THEN
           v_current := aux(i+1);
           aux(I+1) := aux(i);
           aux(i) :=  v_current;
        END IF;
        swapped := TRUE;
  
      END LOOP;
  
    END LOOP;
  
  FOR aux IN (SELECT * FROM    LOOP
  
    DBMS_OUTPUT.PUT_LINE(i|| ' - ' ||chr(9) ||aux.player);
    i := i + 1 ;
  END LOOP;
  </code></pre>