Thursday, May 29, 1997

sy_error.log: application log procedure

Author: Robert Lawson
Environment: Oracle database, HPUX
Description: This procedure is used to write appilcation errors to event log.
Sample Use:
close get_backlog;
EXCEPTIONWHEN OTHERS THEN
sy_error.log(l_program,165,'SO: ' o_order_no '.' o_order_suffix '-' o_line_no);end;

Code Listing:

rem $Author: roblaw $
rem $Locker: roblaw $
rem $Date: 1997/06/12 15:56:36 $
rem $Source: /appl/jit/RCS/ddl/table_s/sy_error.sql,v $
rem $Revision: 1.3 $
set echo on
CREATE OR REPLACE PACKAGE sy_error AS
/* File : sy_error.sql
Author : robert lawson/05-29-1997
Purpose: manage program event log
*/

PROCEDURE log (p_program IN VARCHAR2, p_location NUMBER, p_message IN VARCHAR2);
END sy_error;
/
CREATE OR REPLACE PACKAGE BODY sy_error AS

tot_log NUMBER := 0;
max_log NUMBER := 10;
/*
procedure log
p_program A10 Passed Program name
p_location NUM Passed Location in code (s/b sequence by 10, last is 999)
p_message A200 Passed Message of error, should have values
*/

PROCEDURE log (p_program IN VARCHAR2, p_location NUMBER, p_message IN VARCHAR2) IS
err_num NUMBER;
err_msg CHAR(100);
l_message VARCHAR2(200);
BEGIN
err_num := SQLCODE;
err_msg := SUBSTR(SQLERRM, 1, 100);
if tot_log

No comments: