You cannot specify a referential CONSTRAINT definition for a temporary table.
Repeat the SQL statement without the invalid specification, or create a permanent table instead of the temporary table.