Oracle Error ORA-14462: cannot TRUNCATE temporary table in an autonomous transaction which is already in use by the parent transaction

Oracle Error Message

ORA-14462: cannot TRUNCATE temporary table in an autonomous transaction which is already in use by the parent transaction

Reason for the Error

An attempt was made to TRUNCATE a temporary table in an autonomous transaction which is already in use by the parent transaction.

Solution

Make sure the temporary table is not being used by the parent transaction before trying to TRUNCATE in an autonomous transaction.