"Set autocommit on" is a SQL*Plus command, not a SQL or a PL/SQL command. When you log into SQL*Plus, the default setting for AUTOCOMMIT is OFF:
SQL> show autocommit
autocommit OFF
If you explicitly turn it on in SQL*Plus, then run a PL/SQL block from within that PL/SQL session, autocommit is in effect, and it works.
But "SET AUTOCOMMIT ON" and "SET AUTOCOMMIT OFF" need to occur from the SQL*Plus prompt BEFORE the PL/SQL block begins execution.
Dave
Sandy, Utah, USA @ 18:27 GMT, 11:27 Mountain Time