1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| create or replace function FC_MAP_APP015B_DATA(p_entrepot in number,
p_fournisseur in varchar2,
p_code_appro in varchar2,
p_racine in varchar2,
p_vl in varchar2,
p_magasin in varchar2,
p_user in varchar2,
p_date_deb in varchar2,
p_date_fin in varchar2) return number is
pragma autonomous_transaction;
-- Code retour :
-- 0 : OK
-- ...
-- Constantes
c_longueur_libelle_attribut constant number := 4;
c_longueur_libelle_magasin constant number := 5;
c_debug constant number := 0; -- 1 : Afficher le debug dans dbms_output, ne rien afficher sinon
-- Placer cette variable à 1 uniquement en mode debug !
c_oui constant varchar2(3) := 'Oui';
c_non constant varchar2(3) := 'Non';
c_coche constant varchar2(1) := 'X';
c_decoche constant varchar2(1) := '';
-- Types
type t_cur is ref cursor;
subtype t_oui_non is varchar2(3);
subtype t_coche is varchar2(1);
-- Variables
v_curseur t_cur;
v_requete varchar2(4096);
v_code_retour number(3) := 0;
procedure MAP_APP015B_DEBUG(p_debug_str in varchar2) is
v_debug_pos number(5) := 1;
v_debug_pas number(5) := 120;
v_debug_len number(5);
begin
if c_debug = 1 then
v_debug_len := length(p_debug_str);
dbms_output.put_line('MAP_APP015B_DATA: ' || substr(p_debug_str, v_debug_pos, v_debug_pas));
v_debug_pos := v_debug_pos + v_debug_pas;
while v_debug_pos <= v_debug_len loop
dbms_output.put_line('MAP_APP015B_DATA:... ' || substr(p_debug_str, v_debug_pos, v_debug_pas));
v_debug_pos := v_debug_pos + v_debug_pas;
end loop;
end if;
end MAP_APP015B_DEBUG;
begin
MAP_APP015B_DEBUG('debut');
-- Plein de choses ici normalement
MAP_APP015B_DEBUG('fin (code retour ' || v_code_retour || ')');
commit;
return v_code_retour;
end FC_MAP_APP015B_DATA;
/ |
Partager