create procedure killsession
as
--set serveroutput on; --in oracle sql developer this cannot be ignore
DECLARE
v_cresql clob;
v_id v$session.SID%TYPE;
v_s v$session.SERIAL#%TYPE;
CURSOR cv_cresql_cursor IS
select SID,SERIAL# from v$session;
BEGIN
OPEN cv_cresql_cursor;
LOOP
FETCH cv_cresql_cursor INTO v_id,v_s;
EXIT WHEN cv_cresql_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('alter system kill session '''||v_id||','||v_s||''';');
END LOOP;
CLOSE cv_cresql_cursor;
END;