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

Breadcrumb

Dev Live Dev Intro

This month we are celebrating Developers at AskTOM. We welcome Developers of all levels of experience to join us at our FREE Developer Live events coming in August. Just click on the left to register today! If you are brand new to Database Technology, then we also have got you covered. Just click on the right for your comprehensive FREE training program to kick start your Oracle Database Development journey!

Question and Answer

Chris Saxon

Thanks for the question, RAFAEL.

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

Answered by: Chris Saxon - Last updated: July 14, 2020 - 2:48 pm UTC

Category: PL/SQL - Version: 11.2.0

Viewed 100+ 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 we 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;
/

More to Explore

PL/SQL

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