oracle实现自动记录存储过程、自定义函数执行错误

CREATE OR REPLACE Package Pkg_Stm_Prgerrlog As
  --Purpose: 实现记录系统错误异常信息,便于问题跟踪

  Procedure Sp_Stm_Prgerrlog(p_Sqlcode Varchar2,
                             p_Sqlerrm Varchar2,
                             p_Txt     Varchar2 Default Null,
                             P_ErrSource Varchar2 Default Null);

End Pkg_Stm_Prgerrlog;

CREATE OR REPLACE Package Body Pkg_Stm_Prgerrlog As
  --Purpose:实现记录系统错误异常信息,便于问题跟踪

  Procedure Sp_Stm_Prgerrlog(p_Sqlcode Varchar2,
                             p_Sqlerrm Varchar2,
                             p_Txt     Varchar2 Default Null,
                             P_ErrSource Varchar2 Default null) Is
    Pragma Autonomous_Transaction;
  Begin
    Insert Into Stm_Prgerrlog
      (Stmprgerrlogkey, Sqlcode, Sqlerrm, Txt,ErrSource,CrtDate)
    Values
      (Sq_Stm_Prgerrlog.Nextval, p_Sqlcode, p_Sqlerrm, p_Txt,Upper(P_ErrSource),Sysdate);
    Commit;
  Exception
    When Others Then
      Rollback;
  End Sp_Stm_Prgerrlog;

End Pkg_Stm_Prgerrlog; 


转载于:https://www.cnblogs.com/wala-wo/p/5119262.html

你可能感兴趣的:(oracle实现自动记录存储过程、自定义函数执行错误)