PKG_NKW_OIM.SPB
Source Package Body
Gerenciamento da instância.
create or replace package body pkg_nkw_oim
timestamp '2006-07-07:10:10:10'
is
------------------------------------------------------------------
-- 2006 DataPRO Developers - m@urelio
------------------------------------------------------------------
-- Version: 2.0.2
------------------------------------------------------------------
-- Collections, Records, Variables, Constants, Exceptions, Cursors
------------------------------------------------------------------
------------------------------------------------------------------
----------------------- Private Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
------------------------ Public Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
-- KILL_SESSION
------------------------------------------------------------------
procedure kill_session(fv_audsid in v$session.audsid%TYPE)
is
lv_audsid v$session.audsid%TYPE := userenv('SESSIONID');
begin
if (fv_audsid is not null) then
if (lv_audsid = fv_audsid) then
raise_application_error(-20000,'Esta é a sua própria sessão.|');
end if;
begin
declare cursor get_cur is
select a.sid, a.serial#, a.user#, a.username, a.type
from v$session a
where (a.audsid = fv_audsid);
get_row get_cur%ROWTYPE;
begin
if (not get_cur%ISOPEN) then
open get_cur;
end if;
fetch get_cur into get_row;
if (get_cur%FOUND) then
if (get_row.type <> 'USER' or get_row.user# = 0 or get_row.username is null) then
raise_application_error(-20000,'Esta não é uma sessão de usuário.|');
else
pkg_nkw_rpl.run_code('alter system kill session ''' ||
get_row.sid || ',' || get_row.serial# || '''');
end if;
end if;
if (get_cur%ISOPEN) then
close get_cur;
end if;
end;
end;
end if;
exception
when others then raise;
end kill_session;
end pkg_nkw_oim;
|