PKG_NKW_DNT_EAPB.SPB
Source Package Body
Dynamic Trigger - Execução de blocos PL/SQL anônimos
create or replace package body pkg_nkw_dnt_eapb
timestamp '2006-07-07:10:10:10'
is
------------------------------------------------------------------
-- 2006 DataPRO Developers - m@urelio
------------------------------------------------------------------
-- Version: 2.0.2
------------------------------------------------------------------
-- Collections, Records, Variables, Constants, Exceptions, Cursors
------------------------------------------------------------------
gv_object varchar2(30);
gv_stdcur integer;
gv_execur integer;
gv_stmt pkg_nkw_env.gv_plchar%TYPE;
------------------------------------------------------------------
----------------------- Private Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
-- POP_EAPB
------------------------------------------------------------------
procedure pop_eapb
is
begin
if (upper(nvl(gv_object,'+')) <> upper(nvl(pkg_nkw_dnt.gv_object,'-'))) then
gv_stmt := null;
if (dbms_sql.is_open(gv_stdcur)) then
dbms_sql.close_cursor(gv_stdcur);
end if;
gv_stdcur := null;
gv_execur := null;
begin
declare cursor get_cur is
select a.text
from nkw_dnt_eapb a
where (a.table_name = upper(pkg_nkw_dnt.gv_object));
get_row get_cur%ROWTYPE;
begin
if (not get_cur%ISOPEN) then
open get_cur;
end if;
fetch get_cur into gv_stmt;
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;
pkg_nkw_dnt_std.build_stmt(pkg_nkw_dnt.gt_data, gv_stmt);
gv_object := upper(pkg_nkw_dnt.gv_object);
end if;
exception
when others then
gv_object := null;
raise;
end pop_eapb;
------------------------------------------------------------------
-- LOG_EAPB
------------------------------------------------------------------
procedure log_eapb(fv_stmt in gv_stmt%TYPE)
is
lv_path pkg_nkw_hfs.gv_path%TYPE := '/home/oracle/utlfile';
lv_file pkg_nkw_hfs.gv_file%TYPE := lower(user) || '.' || 'eapb';
lv_data pkg_nkw_env.gv_plchar%TYPE;
begin
pkg_nkw_hfs.fwrite(fv_buffer => pkg_nkw_dnt.gv_label || fv_stmt,
fv_path => lv_path,
fv_file => lv_file);
exception
when others then null;
end log_eapb;
------------------------------------------------------------------
-- PARSE_EAPB
------------------------------------------------------------------
procedure parse_eapb
is
i binary_integer;
begin
if (gv_stmt is not null) then
log_eapb(gv_stmt);
if (dbms_sql.is_open(gv_stdcur)) then
gv_execur := dbms_sql.execute(gv_stdcur);
else
gv_stdcur := dbms_sql.open_cursor;
dbms_sql.parse(gv_stdcur, gv_stmt, dbms_sql.native);
gv_execur := dbms_sql.execute(gv_stdcur);
end if;
end if;
exception
when others then
if (dbms_sql.is_open(gv_stdcur)) then
dbms_sql.close_cursor(gv_stdcur);
end if;
raise;
end parse_eapb;
------------------------------------------------------------------
------------------------ Public Section --------------------------
------------------------------------------------------------------
------------------------------------------------------------------
-- PARSE_ACTION
------------------------------------------------------------------
procedure parse_action
is
begin
pop_eapb;
parse_eapb;
exception
when others then raise;
end parse_action;
end pkg_nkw_dnt_eapb;
|