PKG_NKW_APP.SPB
Source Package Body
Registros e chamadas de aplicações.
create or replace package body pkg_nkw_app
timestamp '2006-07-07:10:10:10'
is
------------------------------------------------------------------
-- 2006 DataPRO Developers - m@urelio
------------------------------------------------------------------
-- Version: 2.0.2
------------------------------------------------------------------
-- Collections, Records, Variables, Constants, Exceptions, Cursors
------------------------------------------------------------------
gv_bln boolean := (FALSE);
------------------------------------------------------------------
----------------------- Private Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
------------------------ Public Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
-- SET_MODULE
------------------------------------------------------------------
procedure set_module(fv_module in pkg_nkw_env.gv_char%TYPE)
is
lv_scope constant pkg_nkw_env.gv_char%TYPE := 'PKG_NKW_APP.SET_MODULE';
begin
dbms_application_info.set_module(module_name => fv_module,
action_name => null);
exception
when others then
pkg_nkw_exc.pop_exception(lv_scope);
end set_module;
------------------------------------------------------------------
-- SET_INFO
------------------------------------------------------------------
procedure set_info(fv_info in pkg_nkw_env.gv_char%TYPE)
is
lv_scope constant pkg_nkw_env.gv_char%TYPE := 'PKG_NKW_APP.SET_INFO';
begin
dbms_application_info.set_client_info(client_info => substr(fv_info, 1, 64));
exception
when others then
pkg_nkw_exc.pop_exception(lv_scope);
end set_info;
------------------------------------------------------------------
-- SET_APPKEY
------------------------------------------------------------------
procedure set_appkey(fv_key in pkg_nkw_env.gv_char%TYPE)
is
lv_scope constant pkg_nkw_env.gv_char%TYPE := 'PKG_NKW_APP.SET_APPKEY';
begin
if (fv_key = '02D0CBFE') then
gv_bln := (TRUE);
else
gv_bln := (FALSE);
end if;
exception
when others then
pkg_nkw_exc.pop_exception(lv_scope, pkg_nkw_exc.gv_devexc);
end set_appkey;
------------------------------------------------------------------
-- APPKEY_ON
------------------------------------------------------------------
function appkey_on
return boolean
is
lv_scope constant pkg_nkw_env.gv_char%TYPE := 'PKG_NKW_APP.APPKEY_ON';
retval boolean;
begin
return gv_bln;
exception
when others then
pkg_nkw_exc.pop_exception(lv_scope);
end appkey_on;
------------------------------------------------------------------
-- GET_SESSION
------------------------------------------------------------------
function get_session
return gr_session%TYPE
is
retrec gr_session%TYPE;
begin
begin
declare cursor get_cur is
select *
from v$session
where (audsid = userenv('sessionid'));
begin
if (not get_cur%ISOPEN) then
open get_cur;
end if;
fetch get_cur into retrec;
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 retrec;
exception
when others then raise;
end get_session;
------------------------------------------------------------------
-- GET_PRM_SESSION
------------------------------------------------------------------
function get_prm_session
return pkg_nkw_env.gv_char%TYPE
is
retval pkg_nkw_env.gv_char%TYPE;
begin
begin
declare cursor get_cur is
select a.parameter || ' = "' || a.value || '"' prm_value
from nls_session_parameters a;
get_row get_cur%ROWTYPE;
begin
if (not get_cur%ISOPEN) then
open get_cur;
end if;
loop
fetch get_cur into get_row;
exit when get_cur%NOTFOUND;
if (nvl(length(retval),0) + nvl(length(get_row.prm_value),0) < 4000) then
retval := retval || get_row.prm_value || chr(10);
end if;
end loop;
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_prm_session;
------------------------------------------------------------------
-- GET_DBVERSION
------------------------------------------------------------------
function get_dbversion
return pkg_nkw_env.gv_plchar%TYPE
is
retval pkg_nkw_env.gv_plchar%TYPE;
begin
begin
declare cursor get_cur is
select banner
from v$version;
get_row get_cur%ROWTYPE;
begin
if (not get_cur%ISOPEN) then
open get_cur;
end if;
loop
fetch get_cur into get_row;
exit when get_cur%NOTFOUND;
retval := retval || get_row.banner || chr(10);
end loop;
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_dbversion;
end pkg_nkw_app;
|