Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROCEDURE error_list (
- p_start IN DATE,
- p_end IN DATE
- )
- IS
- BEGIN
- DBMS_OUTPUT.PUT_LINE('Showing error logs for ' || p_start || ' - ' || p_end);
- DBMS_OUTPUT.PUT_LINE('--------------------------------------------------------------------------');
- FOR rec IN (
- SELECT * FROM ERROR_LOG
- WHERE E_DATE BETWEEN p_start AND p_end
- ORDER BY E_USER ASC, E_DATE DESC
- )
- LOOP
- DBMS_OUTPUT.PUT_LINE('[' || rec.E_DATE || '] ' || rec.E_USER || ' ' || rec.ERROR_CODE || ' ' || rec.ERROR_MESSAGE);
- END LOOP;
- EXCEPTION
- WHEN NO_DATA_FOUND THEN
- DBMS_OUTPUT.PUT_LINE('No error logs.');
- v_error_code := SQLCODE;
- v_error_message := SQLERRM;
- INSERT INTO error_log (e_user, e_date, error_code, error_message)
- VALUES (USER, SYSDATE, v_error_code, v_error_message);
- WHEN e_invalid_datatype THEN
- DBMS_OUTPUT.PUT_LINE('Invalid data type.');
- v_error_code := SQLCODE;
- v_error_message := SQLERRM;
- INSERT INTO error_log (e_user, e_date, error_code, error_message)
- VALUES (USER, SYSDATE, v_error_code, v_error_message);
- WHEN OTHERS THEN
- DBMS_OUTPUT.PUT_LINE('Unexpected error occurred.');
- v_error_code := SQLCODE;
- v_error_message := SQLERRM;
- INSERT INTO error_log (e_user, e_date, error_code, error_message)
- VALUES (USER, SYSDATE, v_error_code, v_error_message);
- END error_list;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement