set verify off
set define '^'

whenever sqlerror exit sql.sqlcode

declare
    invalid_alter_sess exception;
    pragma exception_init(invalid_alter_sess,-02248);
begin
    execute immediate 'alter session set "_ORACLE_SCRIPT"=^1';
exception
    when invalid_alter_sess then
        null;
end;
/
