set serveroutput on
DECLARE
sqlstatement VARCHAR2(200);
BEGIN
  FOR i in (select * from gv$session s where s.type <> 'BACKGROUND' and s.status = 'SNIPED')
  LOOP
     BEGIN
       sqlstatement := 'alter system kill session ''' || i.sid || ',' || i.serial# || ',@' || i.inst_id || ''' immediate';
       dbms_output.put_line(sqlstatement);
       execute immediate sqlstatement;
     EXCEPTION
         WHEN OTHERS THEN
            NULL;
            DBMS_OUTPUT.PUT_LINE(sqlerrm);
     END;          
  END LOOP;
END;
/


