title: PL/SQL: ORA-00947: not enough values when creating function
body: <p>I am creating a package with a function that returns a table. Here is the (simplified) code:</p>
  
  <pre><code>DROP TYPE A_TABLE;
   /
  CREATE OR REPLACE TYPE A_RECORD IS object (
      ID  varchar(10),
      Name    varchar(500)
  );
  / 
  CREATE  TYPE A_TABLE IS TABLE OF A_RECORD;
  /
  CREATE OR REPLACE PACKAGE My_Package AS
  
    results A_TABLE;
  
    FUNCTION A_Data() 
    RETURN A_TABLE;
  
  END My_Package;
  /
  CREATE OR REPLACE PACKAGE BODY My_Package IS 
  
    FUNCTION A_Data() RETURN A_TABLE IS results A_TABLE;
  
    BEGIN
  
      SELECT ID,Name
      BULK COLLECT INTO results 
      FROM Customer_Table customer
  
    RETURN results;
  
    END A_Data;
  
  END My_Package;
  /
  </code></pre>
  
  <p>I get this error on compiling the package:</p>
  
  <pre><code>Error(9,13): PL/SQL: ORA-00947: not enough values
  </code></pre>
  
  <p>The query itself works although there is no data in there at the moment as the database is being worked on at the moment. I can't understand why this is breaking. I think it might be something to do with types? </p>