The pragma is legal in top-level anonymous blocks:
SQL> DECLARE 2 PRAGMA AUTONOMOUS_TRANSACTION; 3 BEGIN 4 COMMIT; 5 END; 6 / PL/SQL procedure successfully completed. SQL> SQL> SQL>