Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PL/SQL local variables dump

Tags:

oracle

plsql

Is it possible to get a string containing a list of the local variables names and their values at any point in time to aid in debugging (i.e. add to a row in the log table of the database as a text string)?

like image 326
Ed Heal Avatar asked Nov 22 '15 13:11

Ed Heal


2 Answers

Is not possible to obtain a String with debug information, however using Sql Developer (Oracle free tool) you can DEBUG your pl/sql as usual likewise any other debug tool for another language including the VALUE for any variable.

This is taken from its documentation:

Sqldeveloper debug overview

HTH

like image 186
Osy Avatar answered Sep 26 '22 15:09

Osy


No, it is not possible.

DBMS_DEBUG can inspect PL/SQL variables, but it requires that the running session suspend and that a second session attach to it to perform the inspection.

I've thought about creating an API to spawn a second session (via DBMS_SCHEDULER) which would stop the calling session, inspect it, restart it, and report back.

That'd be very involved and I'm not sure it'd be a supported use case of DBMS_DEBUG.

Short of that, there is nothing.

like image 37
Matthew McPeak Avatar answered Sep 26 '22 15:09

Matthew McPeak