Tuesday, 29 September 2020

Capture Custom Debug Message in any Oracle Objects

 1. Create a table as below:

CREATE TABLE xx_debug_tbl 
   (SEQ_NUM        NUMBER, 
    DEBUG_MSG      VARCHAR2(500));


2. Create a procedure as below:

CREATE OR REPLACE PROCEDURE xx_debug_proc (p_msg VARCHAR2)
IS
  PRAGMA AUTONOMOUS_TRANSACTION;
  BEGIN
    INSERT INTO xx_debug_tbl
VALUES(FND_LOG_MESSAGES_S.nextval,
p_msg);
COMMIT;
  EXCEPTION
  WHEN OTHERS THEN
   ROLLBACK;
  END;

3. Now, you can use this procedure in oracle objects as below and the debug get stored in xx_debug_tbl table.

xx_debug_proc('This is the custom debug');