title: ORA 06533: Subscript beyond count
body: <p>I created below simple block but getting </p>
  
  <blockquote>
    <p>ORA 06533:Subscript beyond count</p>
  </blockquote>
  
  <p>error.</p>
  
  <p>Can someone please tell me what I am missing in below code.</p>
  
  <pre><code>declare
    type salaryvarray is varray(6) of customers.salary%type;
    salary_array salaryvarray:=salaryvarray();
    c_salary customers.salary%type;
    i integer(2);
    counter number(2);
  begin
    salary_array.extend;
    select count(*) into counter from customers;
    for i in 1..counter loop
      select salary into c_salary from customers where id =i;
      salary_array(i):=c_salary;
    end loop;
  end;
  /
  </code></pre>