The PL/SQL is being parsed, and is failing because at the time of parsing the temporary table does not exist ... to get this to work you'll either have to pre-create the temp table prior to the insert statements being parsed, or make the sql statements dynamic so that they are not parsed until execution time.