PL/SQL - Drop User inside BeginEnd block
Data Definition Language (DDL) Statements


  The DDL statements are:
  
  ... DROP ... (All statements beginning with DROP) ...


PL/SQL does not support DDL as static SQL:

PL/SQL Static SQL

To run a DDL statement in PL/SQL, use dynamic sql:

PL/SQL Dynamic SQL

Example:

begin
  ...
  execute immediate 'DROP USER &amp;OWNER CASCADE';
  ...
end;
/


Or just use:

BEGIN
  FOR r IN (select sid,serial# from v$session where username=&amp;OWNER)
  LOOP
      EXECUTE IMMEDIATE 'alter system kill session ''' || r.sid  || ',' || r.serial# || '''';
  END LOOP;
END;
/

DROP USER &amp;OWNER CASCADE;