title: Pl/SQL: How to sort a table of records?
body: <p>I'm new to pl/sql !
  I'm trying to sort a table of records, using a simple bubble-sort algorithm. What is the problem?</p>
  
  <p>Where could I find more information about using table of records ?</p>
  
  <pre><code>DECLARE
      text VARCHAR2(50);
  TYPE TIP_VECTOR
  IS
      TABLE OF INT INDEX BY BINARY_INTEGER;
  TYPE contorRecord
  IS
      record
      (
          codASCII VARCHAR2(3),
          contor   SMALLINT);
  TYpe tip_vector2
  IS
      TABLE OF contorRecord;
      VECTOR TIP_VECTOR;
      VECTOR2 TIP_VECTOR2 := TIP_VECTOR2();
    aux tip_vector2 := tip_vector2();
      v_char VARCHAR2(3);
      FLAG   BOOLEAN := TRUE;
      t smallint;
      n      SMALLINT := 1;
      ind    SMALLINT := 0;
  
  begin
          AUX.EXTEND(1);
              WHILE(FLAG)
                      LOOP
                      FLAG  := FALSE;
      -- here is the problem; what i'm doing wrong?
                      FOR I IN 1..(vector2.count-1) LOOP 
      -- here is the problem; what i'm doing wrong?
                      IF VECTOR2(I).CONTOR  &lt; VECTOR2(I+1).contor THEN
                      AUX         := VECTOR(I+1);
                      VECTOR(i+1) := VECTOR(I);
                      VECTOR(I)   := AUX;
                      FLAG        := TRUE;
                      END IF;
                      END LOOP;
                      END LOOP;
  end;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Error report:
  
  PLS-00382: expression is of wrong type
  
  PL/SQL: Statement ignored
  
  PLS-00382: expression is of wrong type
  
  PL/SQL: Statement ignored
  06550. 00000 -  "line %s, column %s:\n%s"
  *Cause:    Usually a PL/SQL compilation error.
  *Action:
  </code></pre>