PKG_NKW_EXC.SPB
Source Package Body
Definições e log de exceções.
create or replace package body pkg_nkw_exc
timestamp '2006-07-07:10:10:10'
is
------------------------------------------------------------------
-- 2006 DataPRO Developers - m@urelio
------------------------------------------------------------------
-- Version: 2.0.2
------------------------------------------------------------------
-- Collections, Records, Variables, Constants, Exceptions, Cursors
------------------------------------------------------------------
gv_devbanner constant pkg_nkw_env.gv_char%TYPE := 'Where''s Nulaya ?' || chr(10);
gv_path constant pkg_nkw_hfs.gv_path%TYPE := pkg_nkw_hfs.gv_path;
gv_file constant pkg_nkw_hfs.gv_file%TYPE := 'devexc.log';
------------------------------------------------------------------
----------------------- Private Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
-- GET_SID
------------------------------------------------------------------
function get_sid return varchar2
is
retval pkg_nkw_env.gv_char%TYPE;
begin
begin
declare cursor get_cur is
select chr(10) || to_char(sysdate,'dd/mm/yyyy hh24:mi:ss') || ' (' ||
sid || ',' || serial# || '-' || audsid || ') ' ||
user# || '-' || username || chr(10)
client_info
from v$session
where (audsid = userenv('SESSIONID'));
begin
if (not get_cur%ISOPEN) then
open get_cur;
end if;
fetch get_cur into retval;
if (get_cur%ISOPEN) then
close get_cur;
end if;
exception
when others then
if (get_cur%ISOPEN) then
close get_cur;
end if;
raise;
end;
end;
return retval;
exception
when others then raise;
end get_sid;
------------------------------------------------------------------
------------------------ Public Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
-- POP_EXCEPTION
------------------------------------------------------------------
procedure pop_exception(fv_text in varchar2,
fv_scope in integer := gv_devexc)
is
lv_text pkg_nkw_env.gv_plchar%TYPE;
begin
if (fv_scope = gv_devexc) then
lv_text := gv_devbanner || fv_text || chr(10) || sqlerrm;
pkg_nkw_hfs.fappend(fv_buffer => get_sid || lv_text,
fv_path => gv_path,
fv_file => gv_file);
raise_application_error(-20000, lv_text);
else
lv_text := fv_text || '|' || chr(10) || sqlerrm;
raise_application_error(-20000, lv_text);
end if;
exception
when others then raise;
end pop_exception;
end pkg_nkw_exc;
|