Skip to Main Content
  • Questions
  • Debuging triggers referencing new as new old as old values

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, RAFAEL.

Asked: July 13, 2020 - 3:19 pm UTC

Last updated: July 14, 2020 - 2:48 pm UTC

Version: 11.2.0

Viewed 1000+ times

You Asked

Hi,
I'm wondering if there is a way to see in debug mode, the values that belong to the :new and :old trigger variables in Oracle.
Thanks!

and Chris said...

I'd recommend installing/creating a logging framework that allows you to set the logging level (debug/info/warning/error/...), then stores all higher priority to a database table.

For example, logger:

https://github.com/OraOpenSource/Logger

Then call this in your trigger body, recording all the old/new values of interest. e.g.:

begin
  logger.log ('Old values ' || :old.c1 || ', ' || :old.c2 ... );
  logger.log ('New values ' || :new.c1 || ', ' || :new.c2 ... );
  
  ... trigger processing ...
end;
/


Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library