title: PL-SQL Delete item from a table of Objects
body: <p>I'm trying to delete an item from a variable of type table of objects:</p>
  
  <pre><code>CREATE OR REPLACE TYPE "T_ATTRIBUTEPAGE_ATTRIBUTELIST"  IS TABLE OF o_ATTRIBUTEPAGE_ATTRIBUTELIST;
  
  CREATE OR REPLACE TYPE "O_ATTRIBUTEPAGE_ATTRIBUTELIST" IS OBJECT (
      WizAttrEditID           NUMBER,
      InternalIndex           NUMBER,
      DimensionObjectID       NUMBER,
      AttributeName           VARCHAR2(50),
      AttributeLabel          VARCHAR2(50),
      AttributeType           NUMBER,
      AttributeLength         VARCHAR2(50),
      MandatoryAttribute      NUMBER,
      ReadOnly                NUMBER,
      Name                    VARCHAR2(2000),
      Num                     NUMBER,
      IsModified              NUMBER,
      Colour                  NUMBER);
  </code></pre>
  
  <p>I'm itterating through the list of objects, I checked and the <code>ls_attr_list.COUNT</code> is 16 and I try to delete one item when a criteria is met but I get this error : </p>
  
  <blockquote>
    <p>ORA-01403: no data found</p>
  </blockquote>
  
  <p>which is raised at this line : <code>ls_attr_list.Delete(i);</code></p>
  
  <pre><code>FOR i IN 1..ls_attr_list.COUNT LOOP
             BEGIN
                 IF ls_attr_list(i).attributename = 'PROTECTION_ROLE' THEN
                     ls_attr_list.Delete(i);
                  END IF;
                 EXCEPTION WHEN OTHERS THEN
                   writelog(SQLERRM,'ERROR');
                   END;
              END LOOP;
  </code></pre>
  
  <p>the ls_attr_list is initialize with the input parameter:</p>
  
  <pre><code>PROCEDURE AttribInit(geninfo        IN OUT    o_geninfo,
                       pageinfo       IN OUT    o_attributepage_pageinfo,
                       attributelist  IN OUT    t_attributepage_attributelist,
                       enumlist       IN OUT    t_attributepage_enumlist)
  
  AS
  ls_attr_list := attributelist;
  </code></pre>
  
  <p>Problem when itterating over the list after deleting one item</p>
  
  <pre><code>i := attributelist.FIRST; 
  LOOP 
  IF attributelist(i).attributename = 'PROTECTION_ROLE' THEN attributelist.DELETE(i); 
  END IF; 
  EXIT WHEN i = attributelist.LAST; 
  i := attributelist.NEXT(i);
   END LOOP; 
  --second FOR
  FOR i in 1..attributelist.COUNT LOOP 
  </code></pre>
  
  <blockquote>
    <p>--no data found when it reaches the index of the previous deleted item</p>
  </blockquote>
  
  <pre><code>writelog(attributelist(i).attributename,'attributename'); 
  END LOOP;
  </code></pre>
  
  <p>I'm doing something wrong, any ideas what??</p>