DECLARE
v_ErrorCode NUMBER ;
v_ErrorMsg VARCHAR2 ( 200 );
v_CurrentUser VARCHAR2 ( 8 );
v_Information VARCHAR2 ( 100 );
salary_code VARCHAR2 ( 1 );
INVALID_SALARY_CODE EXCEPTION;
BEGIN
salary_code : = ' x ' ;
IF salary_code NOT IN ( ' A ' , ' B ' , ' C ' ) THEN
RAISE INVALID_SALARY_CODE;
END IF ;
EXCEPTION
WHEN OTHERS THEN
v_ErrorCode : = SQLCODE;
v_ErrorMsg : = SQLERRM;
v_CurrentUser : = USER ;
v_Information : = ' Error encountered on ' || to_char(sysdate) || ' by database user ' || v_CurrentUser;
INSERT INTO log_table(code,message,info)
VALUES (v_ErrorCode,v_ErrorMsg,v_Information);
COMMIT ;
END ;
v_ErrorCode NUMBER ;
v_ErrorMsg VARCHAR2 ( 200 );
v_CurrentUser VARCHAR2 ( 8 );
v_Information VARCHAR2 ( 100 );
salary_code VARCHAR2 ( 1 );
INVALID_SALARY_CODE EXCEPTION;
BEGIN
salary_code : = ' x ' ;
IF salary_code NOT IN ( ' A ' , ' B ' , ' C ' ) THEN
RAISE INVALID_SALARY_CODE;
END IF ;
EXCEPTION
WHEN OTHERS THEN
v_ErrorCode : = SQLCODE;
v_ErrorMsg : = SQLERRM;
v_CurrentUser : = USER ;
v_Information : = ' Error encountered on ' || to_char(sysdate) || ' by database user ' || v_CurrentUser;
INSERT INTO log_table(code,message,info)
VALUES (v_ErrorCode,v_ErrorMsg,v_Information);
COMMIT ;
END ;