CREATE OR REPLACE Procedure P_TRACE_ALL ( PC_MESSAGE in VARCHAR2, PC_ORIGINE in VARCHAR2, PN_1_ID in INTEGER, PN_2_ID in INTEGER ) is --wc_texte_erreur varchar2(500); wc_msg varchar2(4000) default sqlerrm; wc_code number default sqlcode; WC_VAL integer; PRAGMA AUTONOMOUS_TRANSACTION ; begin --activation de la trace ou pas select VALEUR_DATA into WC_VAL from PARAM_MAGIC PM where PM.CODE_DATA = 'NT'; IF(WC_VAL = 1 ) THEN INSERT INTO TRACE (MESSAGE, ORIGINE, FMC_ID, SITUATION_ID,CODE_ERROR, LIGNE ) values ( PC_MESSAGE, PC_ORIGINE, PN_1_ID, PN_2_ID, wc_mess_out, wn_ligne ); END IF; commit; -- enregistre seulement cette INSERT mais pas les autres en cours -- Exception When OTHERS Then Raise_application_error(-20099, 'erreur ecriture trace : '||wc_msg); end; / -------------------------------------------------------- Procedure P_ERROR ( code In integer, message In varchar2 ); Pragma restrict_references (P_ERROR, WNPS, WNDS); Procedure P_ERROR ( code In integer, message In varchar2 ) Is texte_erreur varchar2(4000); tag_deb Constant varchar2(10) := ''; tag_fin Constant varchar2(10) := ''; Begin texte_erreur := tag_deb || message || tag_fin; Raise_application_error(code, texte_erreur); End; --le Raise_application_error est recupere par l'application ------------------------------------------------------------------- Function F_GET_VALEUR_PARAM ( P_CODE In PARAMETRE_GLOBAL.CODE%type, P_VALEUR In PARAMETRE_GLOBAL.LIBELLE%type default NULL ) Return PARAMETRE_GLOBAL.VALEUR_COURANTE%type; Pragma restrict_references (F_GET_VALEUR_PARAMETRE, WNPS, WNDS); -------------------------------------------------------------------- Function F_GET_VALEUR_PARAM ( P_CODE In PARAMETRE_GLOBAL.CODE%type, P_VALEUR In PARAMETRE_GLOBAL.LIBELLE%type default NULL ) Return PARAMETRE_GLOBAL.VALEUR_COURANTE%type Is aux_valeur_courante PARAMETRE_GLOBAL.VALEUR_COURANTE%type; Begin Select VALEUR_COURANTE Into aux_valeur_courante From PARAMETRE_GLOBAL Where CODE = P_CODE; Return aux_valeur_courante; Exception When Others Then If P_VALEUR Is NULL Then P_TRACE_ALL('Paramètre inconnu : erreur paramétrage '||P_CODE, 'F_GET_VALEUR_PARAM', 123, 456); P_ERROR('Paramètre inconnu : erreur paramétrage', P_CODE); Else Return P_VALEUR; End If; End;