title: PL/SQL: Selecting from a table into an assoc array
body: <p>I am trying to select data into a pl/sql associative array in one query. I know I can do this with a hardcoded key, but I wanted to see if there was some way I could reference another column (the key column) instead.</p>
  
  <pre><code>
  DECLARE
  TYPE VarAssoc IS TABLE OF varchar2(2) INDEX BY varchar2(3);
  vars VarAssoc;
  BEGIN
  SELECT foo, bar INTO vars(foo) FROM schema.table;
  END;
  </code></pre>
  
  <p>I get an error saying foo must be declared when I do this. Is there some way to create my associate array in a single query or do I need to fall back on a FOR loop?</p>