Introdução 

 SQL Scripts 

 Packages 

 Packages Body 
 pkg_nkw_exc 
 pkg_nkw_rpl 
 pkg_nkw_std 
 pkg_nkw_app 
 pkg_nkw_spm 
 pkg_nkw_hfs 
 pkg_nkw_sdv 
 pkg_nkw_sys 
 pkg_nkw_obj 
 pkg_nkw_grv 
 pkg_nkw_usr 
 pkg_nkw_cmm 
 pkg_nkw_hlp 
 pkg_nkw_dvp 
 pkg_nkw_dnt_std 
 pkg_nkw_dnt_dvies 
 pkg_nkw_dnt_ccvies 
 pkg_nkw_dnt_logies 
 pkg_nkw_dnt_eppc 
 pkg_nkw_dnt_eapb 
 pkg_nkw_dnt_drmies 
 pkg_nkw_dnt 
 pkg_nkw_drm 
 pkg_nkw_oim 
 pkg_nkw_aud 
 pkg_nkw_dpl 
 pkg_nkw_srw 

 Forms 6i 

 Reports 6i 

Linux

 Downloads 
PKG_NKW_SDV.SPB
Source Package Body
Padronização de Tipos de Dados.
create or replace package body pkg_nkw_sdv
timestamp '2006-07-07:10:10:10'
is
   ------------------------------------------------------------------
   -- 2006 DataPRO Developers - m@urelio
   ------------------------------------------------------------------
   -- Version: 2.0.2
   ------------------------------------------------------------------
   -- Collections, Records, Variables, Constants, Exceptions, Cursors
   ------------------------------------------------------------------
   gv_sdvc1 constant varchar2(256) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ||
				      'ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ' ||
				      '1234567890' ||
				      '!@#$%&*()'' _"+-=/|\?,[.]{;}<:>';
   gv_sdvc2 constant varchar2(256) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ||
				      'ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ' ||
				      'abcdefghijklmnopqrstuvwxyz' ||
				      'áàâãäéèêëíìîïóòôõöúùûüç' ||
				      '1234567890' ||
				      '~!@#$%^&*()'' _"+-=/|\?,[.]{;}<:>ªº' || chr(10);
   gv_sdvc3 constant varchar2(256) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ||
				      '1234567890';
   ------------------------------------------------------------------
   ----------------------- Private Section --------------------------
   ------------------------------------------------------------------
   ------------------------------------------------------------------
   ------------------------ Public Section --------------------------
   ------------------------------------------------------------------
   ------------------------------------------------------------------
   -- IS_SDV
   ------------------------------------------------------------------
   function is_sdv(fv_value in date,
		   fv_std   in varchar2)
      return boolean
   is
      retval boolean := (FALSE);
   begin
      if (fv_value is not null) then
	 if (upper(fv_std) = 'D1') then
	    if (fv_value >= to_date('01/01/0001','dd/mm/yyyy') and
		fv_value = trunc(fv_value)) then
		   retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'D2') then
	    if (fv_value >= to_date('01/01/0001','dd/mm/yyyy')) then
	       retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'D3') then
	    if (fv_value = trunc(fv_value)) then
	       retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'D4') then
	    retval := (TRUE);
	 end if;
      else
	 retval := (TRUE);
      end if;
      return retval;
      exception
	 when others then raise;
   end is_sdv;
   ------------------------------------------------------------------
   function is_sdv(fv_value in number,
		   fv_std   in varchar2)
      return boolean
   is
      retval boolean := (FALSE);
   begin
      if (fv_value is not null) then
	 if (upper(fv_std) = 'N1') then
	    if (fv_value = trunc(fv_value) and fv_value >= 0) then
	       retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'N2') then
	    if (fv_value = trunc(fv_value)) then
	       retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'N3') then
	    if (fv_value >= 0) then
	       retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'N4') then
	    retval := (TRUE);
	 end if;
      else
	 retval := (TRUE);
      end if;
      return retval;
      exception
	 when others then raise;
   end is_sdv;
   ------------------------------------------------------------------
   function is_sdv(fv_value in varchar2,
		   fv_std   in varchar2)
      return boolean
   is
      retval boolean := (FALSE);
   begin
      if (fv_value is not null) then
	 if (upper(fv_std) = 'C1') then
	    if (nvl(length(replace(translate(fv_value, gv_sdvc1, 'A'),'A','')),0) = 0 and
		ltrim(fv_value) = fv_value and rtrim(fv_value) = fv_value) then
		  retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'C2') then
	    if (nvl(length(replace(translate(fv_value, gv_sdvc2, 'A'),'A','')),0) = 0) then
	       retval := (TRUE);
	    end if;
	 elsif (upper(fv_std) = 'C3') then
	    if (nvl(length(replace(translate(fv_value, gv_sdvc3, 'A'),'A','')),0) = 0 and
		ltrim(fv_value) = fv_value and rtrim(fv_value) = fv_value and
		substr(fv_value,1,1) between 'A' and 'Z') then
		  retval := (TRUE);
	    end if;
	 end if;
      else
	 retval := (TRUE);
      end if;
      return retval;
      exception
	 when others then raise;
   end is_sdv;
end pkg_nkw_sdv;
© 2017 DataPRO Developers